Changeset 133 in flair-src for trunk/lib/FlairCore/src/Mutex_impl.cpp


Ignore:
Timestamp:
02/09/17 11:08:31 (5 years ago)
Author:
Sanahuja Guillaume
Message:

modif sterror

File:
1 edited

Legend:

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

    r15 r133  
    2727#ifdef __XENO__
    2828  int status = rt_mutex_create(&mutex, NULL);
    29   if (status != 0)
    30     self->Err("rt_mutex_create error (%s)\n", strerror(-status));
     29  if (status != 0) {
     30                char errorMsg[256];
     31    self->Err("rt_mutex_create error (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg)));
     32        }
    3133#else
    3234  // flag_locked=false;//revoir l'implementation nrt du is_locked
     
    4951Mutex_impl::~Mutex_impl() {
    5052  int status;
     53        char errorMsg[256];
     54       
    5155#ifdef __XENO__
    5256  status = rt_mutex_delete(&mutex);
     
    5559#endif
    5660  if (status != 0)
    57     self->Err("error destroying mutex (%s)\n", strerror(-status));
     61    self->Err("error destroying mutex (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg)));
    5862}
    5963
    6064void Mutex_impl::GetMutex(void) {
    6165  int status;
     66        char errorMsg[256];
     67       
    6268#ifdef __XENO__
    6369  status = rt_mutex_acquire(&mutex, TM_INFINITE);
     
    6773#endif
    6874  if (status != 0)
    69     self->Err("error (%s)\n", strerror(-status));
     75    self->Err("error (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg)));
    7076}
    7177
    7278void Mutex_impl::ReleaseMutex(void) {
    7379  int status;
     80       
    7481#ifdef __XENO__
    7582  status = rt_mutex_release(&mutex);
     
    7885// flag_locked=false;
    7986#endif
    80   if (status != 0)
    81     self->Err("error (%s)\n", strerror(-status));
     87  if (status != 0) {
     88                char errorMsg[256];
     89    self->Err("error (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg)));
     90        }
    8291}
    8392
     
    8897    RT_MUTEX_INFO info;
    8998    int status=rt_mutex_inquire(&mutex_rt,&info);
    90     if(status!=0) mutex->Err("erreur rt_mutex_inquire
    91 (%s)\n",strerror(-status));
     99    if(status!=0) mutex->Err("erreur rt_mutex_inquire (%s)\n",strerror_r(-status, errorMsg, sizeof(errorMsg)));
    92100    if(info.locked>0) return true;
    93101    return false;
Note: See TracChangeset for help on using the changeset viewer.