Changeset 330 in flair-src for trunk/lib/FlairCore/src/ConditionVariable_impl.cpp
- Timestamp:
- Sep 25, 2019, 3:29:26 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/FlairCore/src/ConditionVariable_impl.cpp
r133 r330 53 53 } 54 54 55 void ConditionVariable_impl::CondWait(void) {55 bool ConditionVariable_impl::CondWait(Time timeout) { 56 56 int status; 57 if(timeout==TIME_INFINITE) { 57 58 #ifdef __XENO__ 58 status = 59 rt_cond_wait(&m_ResumeCond, &self->Mutex::pimpl_->mutex, TM_INFINITE); 59 status=rt_cond_wait(&m_ResumeCond, &self->Mutex::pimpl_->mutex, TM_INFINITE); 60 60 #else 61 status =pthread_cond_wait(&m_ResumeCond, &self->Mutex::pimpl_->mutex);61 status=pthread_cond_wait(&m_ResumeCond, &self->Mutex::pimpl_->mutex); 62 62 #endif 63 if (status != 0) { 64 char errorMsg[256]; 65 self->Err("error (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg))); 66 } 63 if(status != 0) { 64 char errorMsg[256]; 65 self->Err("error (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg))); 66 return false; 67 } 68 return true; 69 } else { 70 return CondWaitUntil(GetTime()+timeout); 71 } 67 72 } 68 73 … … 72 77 status = rt_cond_wait_until(&m_ResumeCond, &self->Mutex::pimpl_->mutex, date); 73 78 #else 74 struct timespec restrict;75 restrict.tv_sec = date / 1000000000;76 restrict.tv_nsec = date % 1000000000;79 struct timespec abstime; 80 abstime.tv_sec = date / 1000000000; 81 abstime.tv_nsec = date % 1000000000; 77 82 status = pthread_cond_timedwait(&m_ResumeCond, &self->Mutex::pimpl_->mutex, 78 & restrict);83 &abstime); 79 84 #endif 80 if (status == 0) 81 return true; 85 if (status == 0) return true; 82 86 if (status != ETIMEDOUT) { 83 87 char errorMsg[256];
Note:
See TracChangeset
for help on using the changeset viewer.