]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Fixed false positives reported after the second last pthread_barrier_wait() call...
authorBart Van Assche <bvanassche@acm.org>
Sun, 9 Mar 2008 08:48:01 +0000 (08:48 +0000)
committerBart Van Assche <bvanassche@acm.org>
Sun, 9 Mar 2008 08:48:01 +0000 (08:48 +0000)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7607

exp-drd/drd_barrier.c
exp-drd/drd_clientobj.h

index 9a135b3a9112113c5354b19062410bbab17f9306..b1211053644c6aad6d573b8c9d2ccec0f08ad521 100644 (file)
@@ -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);
   }
index ffd13ca738760f8a6de707e035b7e4bb67eae328..c893ca0acf29ccbe623a171e0c821ef4adc7662a 100644 (file)
@@ -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