=================================================================== RCS file: /home/kde/valgrind/coregrind/Attic/vg_include.h,v retrieving revision 1.235 diff -u -3 -p -r1.235 vg_include.h --- coregrind/vg_include.h 23 Aug 2004 15:06:21 -0000 1.235 +++ coregrind/vg_include.h 27 Sep 2004 20:06:44 -0000 @@ -638,7 +638,7 @@ typedef struct typedef struct { struct _vg_pthread_fastlock __vg_c_lock; /* Protect against concurrent access */ - /*_pthread_descr*/ void* __vg_c_waiting; /* Threads waiting on this condition */ + /*_pthread_descr*/ int __vg_c_waiting; /* Threads waiting on this condition */ // Nb: the following padding removed because it was missing from an // earlier glibc, so the size test in the CONVERT macro was failing. Index: coregrind/vg_libpthread.c =================================================================== RCS file: /home/kde/valgrind/coregrind/vg_libpthread.c,v retrieving revision 1.161 diff -u -3 -p -r1.161 vg_libpthread.c --- coregrind/vg_libpthread.c 23 Aug 2004 15:06:22 -0000 1.161 +++ coregrind/vg_libpthread.c 27 Sep 2004 20:06:45 -0000 @@ -1397,17 +1397,17 @@ int pthread_cond_init( pthread_cond_t *c { vg_pthread_cond_t* vg_cond; CONVERT(cond, cond, vg_cond); - vg_cond->__vg_c_waiting = (/*_pthread_descr*/void*)VG_INVALID_THREADID; + vg_cond->__vg_c_waiting = 0; return 0; } int pthread_cond_destroy(pthread_cond_t *cond) { - /* should check that no threads are waiting on this CV */ - static int moans = N_MOANS; - if (moans-- > 0) - kludged("pthread_cond_destroy", - "(it doesn't check if the cond is waited on)" ); + vg_pthread_cond_t* vg_cond; + CONVERT(cond, cond, vg_cond); + if (vg_cond->__vg_c_waiting != 0) { + return EBUSY; + } return 0; } Index: coregrind/vg_scheduler.c =================================================================== RCS file: /home/kde/valgrind/coregrind/vg_scheduler.c,v retrieving revision 1.171 diff -u -3 -p -r1.171 vg_scheduler.c --- coregrind/vg_scheduler.c 25 Aug 2004 18:58:04 -0000 1.171 +++ coregrind/vg_scheduler.c 27 Sep 2004 20:06:47 -0000 @@ -2358,6 +2358,7 @@ void do_pthread_cond_timedwait_TIMEOUT ( print_pthread_event(tid, msg_buf); } } + cv->__vg_c_waiting--; } @@ -2427,7 +2428,7 @@ void release_N_threads_waiting_on_cond ( } } - + cond->__vg_c_waiting--; n_to_release--; } } @@ -2513,6 +2514,9 @@ void do_pthread_cond_wait ( ThreadId tid VG_(threads)[tid].associated_cv = cond; VG_(threads)[tid].associated_mx = mutex; VG_(threads)[tid].awaken_at = ms_end; + + cond->__vg_c_waiting++; + if (ms_end != 0xFFFFFFFF) add_timeout(tid, ms_end);