Ignore:
Timestamp:
Sep 25, 2019, 3:29:26 PM (5 years ago)
Author:
Sanahuja Guillaume
Message:

use less bandwidth in vprnlite

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/FlairCore/src/ConditionVariable_impl.cpp

    r133 r330  
    5353}
    5454
    55 void ConditionVariable_impl::CondWait(void) {
     55bool ConditionVariable_impl::CondWait(Time timeout) {
    5656  int status;
     57  if(timeout==TIME_INFINITE) {
    5758#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);
    6060#else
    61   status = pthread_cond_wait(&m_ResumeCond, &self->Mutex::pimpl_->mutex);
     61    status=pthread_cond_wait(&m_ResumeCond, &self->Mutex::pimpl_->mutex);
    6262#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  }
    6772}
    6873
     
    7277  status = rt_cond_wait_until(&m_ResumeCond, &self->Mutex::pimpl_->mutex, date);
    7378#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;
    7782  status = pthread_cond_timedwait(&m_ResumeCond, &self->Mutex::pimpl_->mutex,
    78                                   &restrict);
     83                                  &abstime);
    7984#endif
    80   if (status == 0)
    81     return true;
     85  if (status == 0) return true;
    8286  if (status != ETIMEDOUT) {
    8387                char errorMsg[256];
Note: See TracChangeset for help on using the changeset viewer.