fpmas 1.5
global_ghost_mode.h
1#ifndef FPMAS_GLOBAL_GHOST_MODE_H
2#define FPMAS_GLOBAL_GHOST_MODE_H
3
4#include "ghost_mode.h"
6
7namespace fpmas { namespace synchro {
8 namespace ghost {
17 template<typename T>
19 private:
20 T aux;
21 T ghost_data;
22
23 public:
33 : SingleThreadMutex<T>(data), aux(data), ghost_data(data) {
34 }
35
36 const T& read() override {
37 aux = std::move(this->data());
38 this->data() = std::move(ghost_data);
39 return this->data();
40 };
41 void releaseRead() override {
42 this->ghost_data = std::move(this->data());
43 this->data() = std::move(aux);
44 };
45 T& acquire() override {
46 return this->data();
47 };
48 void releaseAcquire() override {
49 };
50
51 void synchronize() override {
52 this->ghost_data = this->data();
53 }
54 };
55 }
56
89 template<typename T>
91}}
92#endif
Definition: ghost_mode.h:449
Definition: global_ghost_mode.h:18
void releaseRead() override
Definition: global_ghost_mode.h:41
const T & read() override
Definition: global_ghost_mode.h:36
void releaseAcquire() override
Definition: global_ghost_mode.h:48
void synchronize() override
Definition: global_ghost_mode.h:51
T & acquire() override
Definition: global_ghost_mode.h:45
GlobalGhostMutex(T &data)
Definition: global_ghost_mode.h:32
Definition: single_thread_mutex.h:13
T & data() override
Definition: single_thread_mutex.h:29
Definition: fpmas.cpp:3