Definition at line 21 of file MCond.h.
◆ MCond() [1/3]
◆ MCond() [2/3]
◆ MCond() [3/3]
Definition at line 21 of file MCond.cc.
22{
23 set((pthread_cond_t*)addr);
24}
◆ ~MCond()
◆ broadcast()
Definition at line 63 of file MCond.cc.
64{
65 if (pthread_cond_broadcast(m_cond) == 0) return true;
66 else return false;
67}
◆ destroy()
Definition at line 51 of file MCond.cc.
52{
53 pthread_cond_destroy(m_cond);
54 return true;
55}
◆ init() [1/2]
Definition at line 35 of file MCond.cc.
36{
37 pthread_condattr_t attr;
38 pthread_condattr_init(&attr);
39 pthread_condattr_setpshared(&attr, PTHREAD_PROCESS_SHARED);
40 pthread_cond_init(m_cond, &attr);
41 pthread_condattr_destroy(&attr);
42 return true;
43}
◆ init() [2/2]
Definition at line 28 of file MCond.cc.
29{
30 set(addr);
31 init();
32 return true;
33}
◆ operator=()
Definition at line 92 of file MCond.cc.
93{
94 m_cond = cond.m_cond;
95 return *this;
96}
◆ set()
Definition at line 45 of file MCond.cc.
46{
47 m_cond = (pthread_cond_t*)addr;
48 return true;
49}
◆ signal()
Definition at line 57 of file MCond.cc.
58{
59 if (pthread_cond_signal(m_cond) == 0) return true;
60 else return false;
61}
◆ size()
Definition at line 24 of file MCond.h.
24{ return sizeof(pthread_cond_t); }
◆ wait() [1/2]
Definition at line 69 of file MCond.cc.
70{
71 if (pthread_cond_wait(m_cond, cond.m_mu) != 0) {
72 return false;
73 }
74 return true;
75}
◆ wait() [2/2]
bool wait |
( |
MMutex & |
mutex, |
|
|
const unsigned int |
sec, |
|
|
const unsigned int |
msec = 0 |
|
) |
| |
Definition at line 77 of file MCond.cc.
79{
80 struct timeval now;
81 struct timespec timeout;
82
83 gettimeofday(&now, NULL);
84 timeout.tv_sec = now.tv_sec + sec;
85 timeout.tv_nsec = now.tv_usec * 1000 + msec;
86 if (pthread_cond_timedwait(m_cond, mutex.m_mu, &timeout) != 0) {
87 return false;
88 }
89 return true;
90}
◆ m_cond
The documentation for this class was generated from the following files: