How to use pthread_sleepon_signal?

Can you show me some examples of pthread_sleepon_signal or
pthread_sleepon_wait? Why and when should we use this function as there
exists function pthread_cond_signal or pthread_cond_wait? I’ve googled but
find no answer, could you help me? Thank a lot£¡
By the way, I encounter a strange problem when I log in openqnx forum, my
browser run into error as :“Sorry!Xanthia has encountered a fatal error in
zone:”, while I could browse all topics of forum before I log in!

johnsonyoung <johnsonyoung2002@yahoo.com.cn> wrote:

Can you show me some examples of pthread_sleepon_signal or
pthread_sleepon_wait? Why and when should we use this function as there
exists function pthread_cond_signal or pthread_cond_wait? I’ve googled but
find no answer, could you help me?

sleepons and condvars do the same thing – in fact, sleepons are
implemented with condvars. The main advantage of the sleepons (vs
condvars & mutexes) is convenience. The main disadvantage is
serialization.

pthread_sleepon_lock() → pthread_mutex_lock( &global_sleepon_mutex);
pthread_sleepon_wait() → allocate condvar;
pthread_condwait( &global_sleepon_mutex,
&allocated_condvar );
pthread_sleepon_signal() → pthread_cond_signal( &allocated_condvar );
pthread_sleepon_unlock() → pthread_mutex_unlock( &global_sleepon_mutex );

Where the global mutex is a process global.

-David

David Gibbs
QNX Training Services
dagibbs@qnx.com