Revision 463434d4

View differences:

include/cbarriermessage.h
24 24
#include "cmessage.h"
25 25
#include "casyncmodule.h"
26 26

  
27
#ifdef ATOMIC_OPS_DEBUG
28
    #include "catomicopsdebug.h"
29
#else
30
    #include <atomic_ops.h>
31
#endif
27 32

  
28 33
/**
29 34
 * This class implements a special barrier message type derived from cMessage.
......
45 50
  private:
46 51
    // the semaphore used to block the calling thread on calling wait()
47 52
    sem_t sem;
48
    bool valid; //set to false if barrier has already been signaled
53
    AO_t valid; //set to false if barrier has already been signaled
49 54

  
50 55
  public:
51 56
    /** @name Constructor and destructor and stuff */
......
129 134
    inline void signal()
130 135
    {
131 136
        sem_post(&sem);
132
        valid = false;
137
        AO_store(&valid, 0);
133 138
    }
134 139

  
135 140
    inline bool isValid() {
136
        return valid;
141
        return AO_load_read(&valid) !=0;
137 142
    }
138 143
    //@}
139 144
};
src/sim/cbarriermessage.cc
23 23
#include "cbarriermessage.h"
24 24

  
25 25
cBarrierMessage::cBarrierMessage() :
26
    cMessage("BarrierMessage"), valid(true)
26
    cMessage("BarrierMessage")
27 27
{
28 28
    sem_init(&sem, 0, 0);
29
    AO_store(&valid, 1);
29 30
}
30 31

  
31 32

  

Also available in: Unified diff