Ignore:
Timestamp:
Apr 8, 2016, 3:40:57 PM (5 years ago)
Author:
Bayard Gildas
Message:

sources reformatted with flair-format-dir script

File:
1 edited

Legend:

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

    r2 r15  
    2424using namespace flair::core;
    2525
    26 ConditionVariable_impl::ConditionVariable_impl(ConditionVariable* self) {
    27     this->self=self;
    28     int status;
     26ConditionVariable_impl::ConditionVariable_impl(ConditionVariable *self) {
     27  this->self = self;
     28  int status;
    2929
    3030#ifdef __XENO__
    31     status=rt_cond_create(&m_ResumeCond,NULL);
     31  status = rt_cond_create(&m_ResumeCond, NULL);
    3232#else
    33     status=pthread_cond_init(&m_ResumeCond, 0);
     33  status = pthread_cond_init(&m_ResumeCond, 0);
    3434#endif
    35     if(status!=0) self->Err("error creating condition variable (%s)\n",strerror(-status));
     35  if (status != 0)
     36    self->Err("error creating condition variable (%s)\n", strerror(-status));
    3637}
    3738
    3839ConditionVariable_impl::~ConditionVariable_impl() {
    39     int status;
     40  int status;
    4041
    4142#ifdef __XENO__
    42     status=rt_cond_delete(&m_ResumeCond);
     43  status = rt_cond_delete(&m_ResumeCond);
    4344#else
    44     status=pthread_cond_destroy(&m_ResumeCond);
     45  status = pthread_cond_destroy(&m_ResumeCond);
    4546#endif
    46     if(status!=0) self->Err("error destroying condition variable (%s)\n",strerror(-status));
     47  if (status != 0)
     48    self->Err("error destroying condition variable (%s)\n", strerror(-status));
    4749}
    4850
    4951void ConditionVariable_impl::CondWait(void) {
    50     int status;
     52  int status;
    5153#ifdef __XENO__
    52     status=rt_cond_wait(&m_ResumeCond, &self->Mutex::pimpl_->mutex,TM_INFINITE);
     54  status =
     55      rt_cond_wait(&m_ResumeCond, &self->Mutex::pimpl_->mutex, TM_INFINITE);
    5356#else
    54     status=pthread_cond_wait(&m_ResumeCond, &self->Mutex::pimpl_->mutex);
     57  status = pthread_cond_wait(&m_ResumeCond, &self->Mutex::pimpl_->mutex);
    5558#endif
    56     if(status!=0) self->Err("error (%s)\n",strerror(-status));
     59  if (status != 0)
     60    self->Err("error (%s)\n", strerror(-status));
    5761}
    5862
    5963bool ConditionVariable_impl::CondWaitUntil(Time date) {
    60     int status;
     64  int status;
    6165#ifdef __XENO__
    62     status=rt_cond_wait_until(&m_ResumeCond, &self->Mutex::pimpl_->mutex,date);
     66  status = rt_cond_wait_until(&m_ResumeCond, &self->Mutex::pimpl_->mutex, date);
    6367#else
    64     struct timespec restrict;
    65     restrict.tv_sec=date/1000000000;
    66     restrict.tv_nsec=date%1000000000;
    67     status=pthread_cond_timedwait(&m_ResumeCond, &self->Mutex::pimpl_->mutex,&restrict);
     68  struct timespec restrict;
     69  restrict.tv_sec = date / 1000000000;
     70  restrict.tv_nsec = date % 1000000000;
     71  status = pthread_cond_timedwait(&m_ResumeCond, &self->Mutex::pimpl_->mutex,
     72                                  &restrict);
    6873#endif
    69     if (status==0) return true;
    70     if(status!=ETIMEDOUT) self->Err("error (%s)\n",strerror(-status));
    71     return false;
     74  if (status == 0)
     75    return true;
     76  if (status != ETIMEDOUT)
     77    self->Err("error (%s)\n", strerror(-status));
     78  return false;
    7279}
    7380
    7481void ConditionVariable_impl::CondSignal(void) {
    75      int status;
     82  int status;
    7683#ifdef __XENO__
    77     status=rt_cond_signal(&m_ResumeCond);
     84  status = rt_cond_signal(&m_ResumeCond);
    7885#else
    79     status=pthread_cond_signal(&m_ResumeCond);
     86  status = pthread_cond_signal(&m_ResumeCond);
    8087#endif
    81     if(status!=0) self->Err("error (%s)\n",strerror(-status));
     88  if (status != 0)
     89    self->Err("error (%s)\n", strerror(-status));
    8290}
Note: See TracChangeset for help on using the changeset viewer.