![]() |
pthread_cond_wait if cancelled leaves mutex locked deadlocking other threads?!
From the following source code
:
int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex)it seems that when a thread gets canceled while waiting for cond it performs pthread_mutex_lock(mutex); ... pthread_exit(PTHREAD_CANCELED); and leaves mutex locked?! so anothe thread is potentially deadlocked?! I tried to look in the source for pthread_exit() if and when the mutex is released but I didn't figure out! |
Re: pthread_cond_wait if cancelled leaves mutex locked deadlocking other threads?!
You might want to check out how to post code properly before you get flamed.
>BstrucT |
Re: pthread_cond_wait if cancelled leaves mutex locked deadlocking other threads?!
So may be to prevent this the correct usage is
:
pthread_mutex_lock(mutex);what you think? |
Re: pthread_cond_wait if cancelled leaves mutex locked deadlocking other threads?!
Noted your comment to thread as unpleasant.
I apologize for the rude reply I have made to your thread, that was dumb. But it is important to note how to format code properly, as I have been tapped accross the fingers for the same mistake, a few times. I wasn't trying to be rude, just trying to give you a heads up man. My apologies if it went down wrong. |
| All times are GMT -5. The time now is 4:23 AM. |
Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC