Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old May 7th, 2008, 9:39 AM   #1
mynickmynick
Newbie
 
Join Date: May 2008
Posts: 7
Rep Power: 0 mynickmynick is on a distinguished road
sem_wait()/post() Vs. pthread_cond_wait()/broadcast()

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()/post() are more flexible and do not need to be surrounded by mutex lock/unlock
(2) as a consequence 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() are slower? How much slower?
mynickmynick is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 9:53 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC