Changeset 133 in flair-src for trunk/lib/FlairCore/src/Thread_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/Thread_impl.cpp

    r118 r133  
    7878void Thread_impl::Start(void) {
    7979  int status;
     80        char errorMsg[256];
    8081
    8182  isRunning = true;
     
    9495#endif // RT_STACK_SIZE
    9596  if (status != 0) {
    96     self->Err("rt_task_create error (%s)\n", strerror(-status));
     97    self->Err("rt_task_create error (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg)));
    9798  } else {
    9899    //_printf("rt_task_create ok %s\n",th_name);
     
    101102  status = rt_task_start(&task_rt, &main_rt, (void *)this);
    102103  if (status != 0) {
    103     self->Err("rt_task_start error (%s)\n", strerror(-status));
     104    self->Err("rt_task_start error (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg)));
    104105  } else {
    105106    //_printf("rt_task_start ok %s\n",th_name);
     
    178179#ifdef __XENO__
    179180  int status = rt_task_set_periodic(&task_rt, TM_NOW, period * 1000);
    180   if (status != 0)
    181     self->Err("Error rt_task_set_periodic %s\n", strerror(-status));
     181  if (status != 0) {
     182                char errorMsg[256];
     183    self->Err("Error rt_task_set_periodic %s\n", strerror_r(-status, errorMsg, sizeof(errorMsg)));
     184        }
    182185#else
    183186  next_time -= period;
     
    198201#ifdef __XENO__
    199202  int status = rt_task_set_periodic(&task_rt, TM_NOW, period * 1000 * 1000);
    200   if (status != 0)
    201     self->Err("Error rt_task_set_periodic %s\n", strerror(-status));
     203  if (status != 0) {
     204                char errorMsg[256];
     205    self->Err("Error rt_task_set_periodic %s\n", strerror_r(-status, errorMsg, sizeof(errorMsg)));
     206        }
    202207#else
    203208  next_time -= period;
     
    218223  unsigned long overruns_r;
    219224  int status = rt_task_wait_period(&overruns_r);
    220   if (status != 0)
    221     self->Err("Error rt_task_wait_period %s\n", strerror(-status));
    222   if (status == -ETIMEDOUT)
     225  if (status != 0) {
     226                char errorMsg[256];
     227    self->Err("Error rt_task_wait_period %s\n", strerror_r(-status, errorMsg, sizeof(errorMsg)));
     228        }
     229  if (status == -ETIMEDOUT) {
    223230    self->Err("overrun: %lld\n", overruns_r);
     231        }
    224232#else
    225233  self->SleepUntil(next_time);
     
    310318  int status = rt_task_inquire(NULL, &info);
    311319  if (status != 0) {
    312     self->Err("Error rt_task_inquire %s\n", strerror(-status));
     320                char errorMsg[256];
     321    self->Err("Error rt_task_inquire %s\n", strerror_r(-status, errorMsg, sizeof(errorMsg)));
    313322  } else
    314323#endif
     
    348357  if (isRunning == true) {
    349358    int status;
     359                char errorMsg[256];
    350360
    351361#ifdef __XENO__
     
    355365#endif
    356366    if (status != 0)
    357       self->Err("error %s\n", strerror(-status));
     367      self->Err("error %s\n", strerror_r(-status, errorMsg, sizeof(errorMsg)));
    358368    isRunning = false;
    359369  }
Note: See TracChangeset for help on using the changeset viewer.