You.i Engine
YiCountDownLatch.h
Go to the documentation of this file.
1 // © You i Labs Inc. 2000-2017. All rights reserved.
2 #ifndef _YI_COUNT_DOWN_LATCH_H_
3 #define _YI_COUNT_DOWN_LATCH_H_
4 
5 #include "signal/YiSignal.h"
6 
7 class CYIMutex;
8 class CYIWaitCondition;
9 
15 // this object cannot be destroyed in a thread-safe manner if there are objects waiting on it.
16 
33 {
34 public:
35  CYICountDownLatch(uint32_t uCount);
37 
43  void CountDown();
44 
50  void Wait() const;
51 
59  bool Wait(uint64_t uTimeoutMs) const;
60 
64  bool IsFinished() const;
65 
69  uint32_t GetCount() const;
70 
72 
73 private:
74  mutable CYIMutex m_mutex;
75  mutable CYIWaitCondition m_finishedCondition;
76  uint32_t m_uCount;
77 };
78 
83 #endif // _YI_COUNT_DOWN_LATCH_H_
Definition: YiMutex.h:110
uint32_t GetCount() const
bool IsFinished() const
Definition: YiCountDownLatch.h:32
CYICountDownLatch(uint32_t uCount)
CYISignal Finished
Called when the Count reaches zero.
Definition: YiCountDownLatch.h:71
A class used to block a thread until a condition is met, as signaled by a different thread...
Definition: YiWaitCondition.h:64
Signals and slots are a thread-safe and flexible communication framework that will allow various obje...
Definition: YiSignal.h:164
void Wait() const