Definition at line 19 of file Cond.h.
◆ Cond() [1/2]
◆ Cond() [2/2]
Definition at line 20 of file Cond.cc.
20 : m_cond_t(cond.m_cond_t)
21{
22}
◆ ~Cond()
◆ broadcast()
Definition at line 43 of file Cond.cc.
44{
45 if (pthread_cond_broadcast(&m_cond_t) == 0) return true;
46 else return false;
47}
◆ destroy()
Definition at line 71 of file Cond.cc.
72{
73 if (pthread_cond_destroy(&m_cond_t) == 0) return true;
74 else return false;
75}
◆ init()
Definition at line 24 of file Cond.cc.
25{
26 pthread_condattr_t mattr;
27 pthread_condattr_init(&mattr);
28 pthread_condattr_setpshared(&mattr, PTHREAD_PROCESS_SHARED);
29 if (pthread_cond_init(&m_cond_t, &mattr) != 0) {
30 return false;
31 }
32 pthread_condattr_destroy(&mattr);
33
34 return true;
35}
◆ signal()
Definition at line 37 of file Cond.cc.
38{
39 if (pthread_cond_signal(&m_cond_t) == 0) return true;
40 else return false;
41}
◆ wait() [1/2]
| bool wait |
( |
Mutex & | mutex | ) |
|
Definition at line 49 of file Cond.cc.
50{
51 if (pthread_cond_wait(&m_cond_t, &mutex.m_mu) != 0) {
52 return false;
53 }
54 return true;
55}
◆ wait() [2/2]
| bool wait |
( |
Mutex & | mutex, |
|
|
const unsigned int | sec, |
|
|
const unsigned int | msec = 0 ) |
Definition at line 57 of file Cond.cc.
58{
59 struct timeval now;
60 struct timespec timeout;
61
62 gettimeofday(&now, NULL);
63 timeout.tv_sec = now.tv_sec + sec;
64 timeout.tv_nsec = now.tv_usec * 1000 + msec;
65 if (pthread_cond_timedwait(&m_cond_t, &mutex.m_mu, &timeout) != 0) {
66 return false;
67 }
68 return true;
69}
◆ m_cond_t
The documentation for this class was generated from the following files: