Project Home
Project Home
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - Mutex Priority Ceiling: (3 Items)
   
Mutex Priority Ceiling  
We have a scenario like when lower priority thread is using mutex lock and higher priority thread arrives, it should 
wait till the lower priority thread lock is unlocked, we use the below code for the same, but it is not working please 
help us in this regard,

pthread_mutexattr_t bb_mutex_attr;
rv = pthread_mutexattr_init(&bb_mutex_attr);

rv = pthread_mutexattr_setprioceiling(&bb_mutex_attr, 63);

rv = pthread_mutexattr_setprotocol(&bb_mutex_attr, PTHREAD_PRIO_PROTECT );

// Initialize the Mutex for bb_Lock/Unlock
rv = pthread_mutex_init(&bb_mutex, &bb_mutex_attr);

rv = pthread_mutex_setprioceiling(&bb_mutex, HIGHEST_PBO_PRIORITY, &oldceiling);

Re: Mutex Priority Ceiling  
In target_nto.h file, it is specified 

int		__prioceiling;	/* Not implemented */ \

in struct _sync_attr {

Is that a valid comment. Will it work in QNX 6.6?
Re: Mutex Priority Ceiling  
Are you saying the the mutex locked thread's priority gets adjusted to a priority higher than your max of 63?
Are any error codes being returned from your various calls?

Regardless of your code here, the priority of the thread that owns the mutex will be boosted up to the priority of the 
highest mutex blocked thread, with a max ceiling of 63.  The mutex blocked thread will always wait (block) until the 
thread that owns the mutex releases it.