View Single Post
  #1 (permalink)  
Old 05-07-2008, 09:35 AM
mynickmynick mynickmynick is offline
Newbie
 
Join Date: May 2008
Posts: 11
Rep Power: 0
mynickmynick is on a distinguished road
Default pthread_cond_wait() VS. sem_wait()

What are advantages/disadvantages of using

sem_wait() and sem_post() instead of
pthread_cond_wait() and pthread_cond_broadcast()

for sincronizing pthreads?

I guess but please correct me:

Advantages:
(1) sem_wait() can be used inside signal handlers or async call backs (pthread_cond need pthread_mutex which is not signal handler safe)

Disadvantages:
(1) sem_wait()/post() is slower?

Last edited by mynickmynick; 05-07-2008 at 10:13 AM.
Reply With Quote

Sponsored Links