]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Added a definition for a new annotation: ANNOTATE_HAPPENS_DONE().
authorBart Van Assche <bvanassche@acm.org>
Sun, 7 Mar 2010 10:44:46 +0000 (10:44 +0000)
committerBart Van Assche <bvanassche@acm.org>
Sun, 7 Mar 2010 10:44:46 +0000 (10:44 +0000)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11068

drd/drd.h

index d515c8d9e8df6732c5e9a7ff94ac823cc4fd218b..64adfe99b5e31f6461630de6f9ca9ffba987de7b 100644 (file)
--- a/drd/drd.h
+++ b/drd/drd.h
 /**
  * @defgroup RaceDetectionAnnotations Data race detection annotations.
  *
- * @see See also the source file <a href="http://code.google.com/p/google-perftools/source/browse/trunk/src/base/dynamic_annotations.h">dynamic_annotations.h</a>
+ * @see See also the source file <a href="http://code.google.com/p/data-race-test/source/browse/trunk/dynamic_annotations/dynamic_annotations.h</a>
+
  * in the ThreadSanitizer project.
  */
 /*@{*/
 
 /**
- * Tell DRD to insert a mark. addr is the address of an object that is not a
- * pthread synchronization object. Inserting two 'happens before' annotations
- * while no thread has passed by a 'happens after' annotation is an error.
+ * Tell DRD to insert a happens-before mark. addr is the address of an object
+ * that is not a pthread synchronization object.
  */
 #define ANNOTATE_HAPPENS_BEFORE(addr) DRDCL_(annotate_happens_before)(addr)
 
 /**
- * Tell DRD that the memory accesses executed after this annotation will happen
- * after the memory accesses performed before the most recent
+ * Tell DRD that the memory accesses executed after this annotation will
+ * happen after all memory accesses performed before all preceding
  * ANNOTATE_HAPPENS_BEFORE(addr). addr is the address of an object that is not
- * a pthread synchronization object. Inserting a 'happens after' annotation
- * before any other thread has passed by a 'happens before' annotation for the
+ * a pthread synchronization object. Inserting a happens-after annotation
+ * before any other thread has passed by a happens-before annotation for the
  * same address is an error.
  */
 #define ANNOTATE_HAPPENS_AFTER(addr) DRDCL_(annotate_happens_after)(addr)
 
+/**
+ * Tell DRD that no more happens-after annotations will follow.
+ */
+#define ANNOTATE_HAPPENS_DONE(addr) DRDCL_(annotate_happens_done)(addr)
+
 /**
  * Tell DRD that waiting on the condition variable at address cv has succeeded
  * and a lock on the mutex at address mtx is now held. Since DRD always inserts
@@ -347,14 +352,17 @@ enum {
       = VG_USERREQ_TOOL_BASE('H','G') + 256 + 32,
    /* args: Char*. */
 
-   /* Tell DRD to insert a happens before annotation. */
+   /* Tell DRD to insert a happens-before annotation. */
    VG_USERREQ__DRD_ANNOTATE_HAPPENS_BEFORE
       = VG_USERREQ_TOOL_BASE('H','G') + 256 + 33,
    /* args: Addr. */
-   /* Tell DRD to insert a happens after annotation. */
+   /* Tell DRD to insert a happens-after annotation. */
    VG_USERREQ__DRD_ANNOTATE_HAPPENS_AFTER
       = VG_USERREQ_TOOL_BASE('H','G') + 256 + 34,
    /* args: Addr. */
+   /* Tell DRD to insert a happens-done annotation. */
+   VG_USERREQ__DRD_ANNOTATE_HAPPENS_DONE,
+   /* args: Addr. */
 
 };
 
@@ -455,6 +463,14 @@ void DRDCL_(annotate_happens_after)(const void* const addr)
                               addr, 0, 0, 0, 0);
 }
 
+static __inline__
+void DRDCL_(annotate_happens_done)(const void* const addr)
+{
+   int res;
+   VALGRIND_DO_CLIENT_REQUEST(res, 0, VG_USERREQ__DRD_ANNOTATE_HAPPENS_DONE,
+                              addr, 0, 0, 0, 0);
+}
+
 static __inline__
 void DRDCL_(annotate_rwlock_create)(const void* const rwlock)
 {