Author: bart
Date: 2008-03-09 08:48:01 +0000 (Sun, 09 Mar 2008)
New Revision: 7607

Log:
Fixed false positives reported after the second last pthread_barrier_wait() 
call in a thread.

Modified:
   trunk/exp-drd/drd_barrier.c
   trunk/exp-drd/drd_clientobj.h


Modified: trunk/exp-drd/drd_barrier.c
===================================================================
--- trunk/exp-drd/drd_barrier.c 2008-03-09 08:46:11 UTC (rev 7606)
+++ trunk/exp-drd/drd_barrier.c 2008-03-09 08:48:01 UTC (rev 7607)
@@ -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 @@
   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 @@
     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 @@
         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 @@
     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);
   }

Modified: trunk/exp-drd/drd_clientobj.h
===================================================================
--- trunk/exp-drd/drd_clientobj.h       2008-03-09 08:46:11 UTC (rev 7606)
+++ trunk/exp-drd/drd_clientobj.h       2008-03-09 08:48:01 UTC (rev 7607)
@@ -103,6 +103,7 @@
   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


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Valgrind-developers mailing list
Valgrind-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/valgrind-developers

Reply via email to