From: Bart Van Assche Date: Sun, 9 Mar 2008 08:48:01 +0000 (+0000) Subject: Fixed false positives reported after the second last pthread_barrier_wait() call... X-Git-Tag: svn/VALGRIND_3_4_0~934 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=8164647b5ea6f7b5291e7146e1ea68a7b3e634fd;p=thirdparty%2Fvalgrind.git Fixed false positives reported after the second last pthread_barrier_wait() call in a thread. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7607 --- diff --git a/exp-drd/drd_barrier.c b/exp-drd/drd_barrier.c index 9a135b3a91..b121105364 100644 --- a/exp-drd/drd_barrier.c +++ b/exp-drd/drd_barrier.c @@ -39,7 +39,7 @@ // Type definitions. -/* Information associated with one thread participating in a barrier. */ +/** Information associated with one thread participating in a barrier. */ struct barrier_thread_info { UWord tid; // A DrdThreadId @@ -110,6 +110,7 @@ void barrier_initialize(struct barrier_info* const p, tl_assert(sizeof(((struct barrier_thread_info*)0)->tid) >= sizeof(DrdThreadId)); p->oset = VG_(OSetGen_Create)(0, 0, VG_(malloc), VG_(free)); + vc_init(&p->finished_threads_vc, 0, 0); } /** Deallocate the memory allocated by barrier_initialize() and in p->oset. @@ -138,6 +139,7 @@ void barrier_cleanup(struct barrier_info* p) barrier_thread_destroy(q); } VG_(OSetGen_Destroy)(p->oset); + vc_cleanup(&p->finished_threads_vc); } /** Look up the client-side barrier address barrier in s_barrier[]. If not @@ -287,6 +289,7 @@ void barrier_post_wait(const DrdThreadId tid, const Addr barrier, thread_combine_vc2(tid, &r->vc[p->post_iteration]); } } + thread_combine_vc2(tid, &p->finished_threads_vc); thread_new_segment(tid); @@ -309,6 +312,7 @@ void barrier_thread_delete(const DrdThreadId tid) struct barrier_thread_info* q; const UWord word_tid = tid; q = VG_(OSetGen_Remove)(p->oset, &word_tid); + vc_combine(&p->finished_threads_vc, &q->vc[p->post_iteration]); barrier_thread_destroy(q); VG_(OSetGen_FreeNode)(p->oset, q); } diff --git a/exp-drd/drd_clientobj.h b/exp-drd/drd_clientobj.h index ffd13ca738..c893ca0acf 100644 --- a/exp-drd/drd_clientobj.h +++ b/exp-drd/drd_clientobj.h @@ -103,6 +103,7 @@ struct barrier_info Word pre_waiters_left; // number of waiters left for a complete barrier. Word post_waiters_left; // number of waiters left for a complete barrier. OSet* oset; // Thread-specific barrier information. + VectorClock finished_threads_vc; }; struct rwlock_info