Changeset 203 in flair-src for trunk/lib/FlairCore/src/Semaphore_impl.cpp


Ignore:
Timestamp:
Nov 9, 2017, 2:00:49 PM (7 years ago)
Author:
Bayard Gildas
Message:

Added timeout on SharedMem Read

File:
1 edited

Legend:

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

    r133 r203  
    5353}
    5454
     55bool Semaphore_impl::TryGetSemaphore() {
     56#ifdef __XENO__
     57  return !rt_sem_p(&semaphore, TM_NONBLOCK);
     58#else
     59  return !sem_trywait(&semaphore);
     60#endif
     61}
     62
    5563bool Semaphore_impl::GetSemaphore(Time timeout) {
    5664  int status;
     
    7583        if (status != 0) {
    7684                if (errno == ETIMEDOUT) {
    77                         self->Warn("warning : semaphore timedout\n");   
     85#ifdef DEBUG
     86                        self->Warn("warning : semaphore timedout\n");
     87#endif
    7888                } else {
    7989                                        char errorMsg[256];
Note: See TracChangeset for help on using the changeset viewer.