Changeset 275

Show
Ignore:
Timestamp:
06/26/06 13:36:03 (16 years ago)
Author:
pieterpalmers
Message:

- fix bug that prevented RT threads from being created

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/libfreebob-2.0/src/libutil/PosixThread.cpp

    r266 r275  
    8080        pthread_attr_init(&attributes); 
    8181 
     82        if ((res = pthread_attr_setinheritsched(&attributes, PTHREAD_EXPLICIT_SCHED))) { 
     83            debugError("Cannot request explicit scheduling for RT thread  %d %s", res, strerror(errno)); 
     84            return -1; 
     85        } 
     86        if ((res = pthread_attr_setdetachstate(&attributes, PTHREAD_CREATE_JOINABLE))) { 
     87            debugError("Cannot request joinable thread creation for RT thread  %d %s", res, strerror(errno)); 
     88            return -1; 
     89        } 
     90        if ((res = pthread_attr_setscope(&attributes, PTHREAD_SCOPE_SYSTEM))) { 
     91            debugError("Cannot set scheduling scope for RT thread %d %s", res, strerror(errno)); 
     92            return -1; 
     93        } 
     94 
    8295        if ((res = pthread_attr_setschedpolicy(&attributes, SCHED_FIFO))) { 
    8396 
    8497        //if ((res = pthread_attr_setschedpolicy(&attributes, SCHED_RR))) { 
    8598            debugError("Cannot set FIFO scheduling class for RT thread  %d %s", res, strerror(errno)); 
    86             return -1; 
    87         } 
    88  
    89         if ((res = pthread_attr_setscope(&attributes, PTHREAD_SCOPE_SYSTEM))) { 
    90             debugError("Cannot set scheduling scope for RT thread %d %s", res, strerror(errno)); 
    9199            return -1; 
    92100        } 
     
    157165    //if ((res = pthread_setschedparam(fThread, SCHED_FIFO, &rtparam)) != 0) { 
    158166 
    159     if ((res = pthread_setschedparam(fThread, SCHED_RR, &rtparam)) != 0) { 
     167    if ((res = pthread_setschedparam(fThread, SCHED_FIFO, &rtparam)) != 0) { 
    160168        debugError("Cannot use real-time scheduling (FIFO/%d) " 
    161169                   "(%d: %s)", rtparam.sched_priority, res,