barrier.h 327 B

123456789101112131415161718192021222324
  1. #ifndef __BARRIER_H
  2. #define __BARRIER_H
  3. #include "fixed_types.h"
  4. #include "cond.h"
  5. class Barrier
  6. {
  7. public:
  8. Barrier(int count);
  9. ~Barrier();
  10. void wait();
  11. private:
  12. int m_count;
  13. int m_arrived;
  14. int m_leaving;
  15. Lock m_lock;
  16. ConditionVariable m_cond;
  17. };
  18. #endif // __BARRIER_H