[llvm-commits] [llvm] r106756 - /llvm/trunk/include/llvm/ADT/Statistic.h

Dan Gohman gohman at apple.com
Thu Jun 24 09:31:32 PDT 2010


Author: djg
Date: Thu Jun 24 11:31:32 2010
New Revision: 106756

URL: http://llvm.org/viewvc/llvm-project?rev=106756&view=rev
Log:
Add a comment about a thread safety issue in Statistic.h.

Modified:
    llvm/trunk/include/llvm/ADT/Statistic.h

Modified: llvm/trunk/include/llvm/ADT/Statistic.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/Statistic.h?rev=106756&r1=106755&r2=106756&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/Statistic.h (original)
+++ llvm/trunk/include/llvm/ADT/Statistic.h Thu Jun 24 11:31:32 2010
@@ -56,6 +56,10 @@
   }
   
   const Statistic &operator++() {
+    // FIXME: This function and all those that follow carefully use an
+    // atomic operation to update the value safely in the presence of
+    // concurrent accesses, but not to read the return value, so the
+    // return value is not thread safe.
     sys::AtomicIncrement(&Value);
     return init();
   }





More information about the llvm-commits mailing list