12 #include <sys/errno.h>
20 pthread_mutex_init(&mMutex,
NULL);
21 pthread_cond_init(&mCondVar,
NULL);
28 pthread_cond_destroy(&mCondVar);
29 pthread_mutex_destroy(&mMutex);
39 pthread_mutex_lock(&mMutex);
41 theError = pthread_cond_broadcast(&mCondVar);
42 pthread_mutex_unlock(&mMutex);
57 pthread_mutex_lock(&mMutex);
59 pthread_mutex_unlock(&mMutex);
95 mManualReset = manualReset;
105 *pManualReset = mManualReset;
117 static const long long NS_PER_SEC = 1000000000ULL;
120 int64_t nanos = timeout;
130 ts.tv_sec += (nanos / NS_PER_SEC);
131 ts.tv_nsec = (nanos % NS_PER_SEC);
133 pthread_mutex_lock(&mMutex);
135 if (
false == mSignaled)
137 result = pthread_cond_timedwait(&mCondVar, &mMutex, &ts);
139 if (0 != result &&
false == mSignaled)
141 if (result == ETIMEDOUT)
150 "AJAEventImpl::WaitForSignal() "
151 "pthread_cond_timedwait returns error %d", result);
160 pthread_mutex_unlock(&mMutex);