20 #ifndef COIL_CONDITION_H 21 #define COIL_CONDITION_H 66 ::pthread_cond_init(&m_cond, 0);
86 ::pthread_cond_destroy(&m_cond);
106 ::pthread_cond_signal(&m_cond);
126 ::pthread_cond_broadcast(&m_cond);
150 return 0 == ::pthread_cond_wait(&m_cond, &m_mutex.mutex_);
178 bool wait(
long second,
long nano_second = 0)
184 abstime.tv_sec = tv.tv_sec + second;
185 abstime.tv_nsec = tv.tv_usec * 1000 + nano_second;
186 if (abstime.tv_nsec >= 1000000000) {
187 abstime.tv_nsec -= 1000000000;
190 return 0 == ::pthread_cond_timedwait(&m_cond, &m_mutex.mutex_, &abstime);
196 pthread_cond_t m_cond;
200 #endif // COIL_CONDITION_H bool wait()
Wait of the thread practice.
Definition: Condition.h:148
void signal()
Resume of the thread practice.
Definition: Condition.h:104
int gettimeofday(struct timeval *tv, struct timezone *tz)
Get the time and timezone.
Definition: Time.h:137
bool wait(long second, long nano_second=0)
Thread practice wait of set time.
Definition: Condition.h:178
~Condition()
Destructor.
Definition: Condition.h:84
Condition template class.
Definition: Condition.h:44
Condition(M &mutex)
Constructor.
Definition: Condition.h:63
void broadcast()
Resume of all the thread practice.
Definition: Condition.h:124
Common Object Interface Layer.
Definition: Affinity.h:28