|
From: Mincu A. <al...@cy...> - 2003-08-27 09:59:41
|
Here is the problem : My program has 3 threads that sleep in pthread_cond_timedwait, when i send a cancelation signal to one of the threads valgrind gives the following error: =3D=3D2417=3D=3D =3D=3D2417=3D=3D Thread 3: =3D=3D2417=3D=3D pthread_mutex_unlock: mutex is not locked =3D=3D2417=3D=3D at 0x402B1CC0: __pthread_mutex_unlock (in /usr/lib/valgrind/libpthread.so) =3D=3D2417=3D=3D by 0x402B120E: (within /usr/lib/valgrind/libpthread.so) =3D=3D2417=3D=3D by 0xBEADDEEE: ??? =3D=3D2417=3D=3D by 0x8054072: messages_main (messages.c:242) I guess that error occurs when the cleanup functions are executed because i do something like this: pthread_cleanup_push((void*)pthread_mutex_unlock, &mutex); pthread_mutex_lock(&mutex); ..... pthread_cond_timedwait(...); ..... pthread_cleanup_pop(1); My question is: Should pthread_cond_timedwait lock the mutex when exiting because of cancelation? |