fpmas 1.6
global_ghost_mode.h
Go to the documentation of this file.
1#ifndef FPMAS_GLOBAL_GHOST_MODE_H
2#define FPMAS_GLOBAL_GHOST_MODE_H
3
4#include "ghost_mode.h"
6
11namespace fpmas { namespace synchro {
12 namespace ghost {
21 template<typename T>
23 private:
24 T aux;
25 T ghost_data;
26
27 public:
37 : SingleThreadMutex<T>(data), aux(data), ghost_data(data) {
38 }
39
40 const T& read() override {
41 aux = std::move(this->data());
42 this->data() = std::move(ghost_data);
43 return this->data();
44 };
45 void releaseRead() override {
46 this->ghost_data = std::move(this->data());
47 this->data() = std::move(aux);
48 };
49 T& acquire() override {
50 return this->data();
51 };
52 void releaseAcquire() override {
53 };
54
55 void synchronize() override {
56 this->ghost_data = this->data();
57 }
58 };
59 }
60
93 template<typename T>
95}}
96#endif
Definition: ghost_mode.h:450
Definition: global_ghost_mode.h:22
void releaseRead() override
Definition: global_ghost_mode.h:45
const T & read() override
Definition: global_ghost_mode.h:40
void releaseAcquire() override
Definition: global_ghost_mode.h:52
void synchronize() override
Definition: global_ghost_mode.h:55
T & acquire() override
Definition: global_ghost_mode.h:49
GlobalGhostMutex(T &data)
Definition: global_ghost_mode.h:36
Definition: single_thread_mutex.h:17
T & data() override
Definition: single_thread_mutex.h:33
Definition: fpmas.cpp:3