[llvm] r219640 - Updating documentation as per Chandler's feedback.

Chris Bieneman beanz at apple.com
Mon Oct 13 16:03:45 PDT 2014


Author: cbieneman
Date: Mon Oct 13 18:03:45 2014
New Revision: 219640

URL: http://llvm.org/viewvc/llvm-project?rev=219640&view=rev
Log:
Updating documentation as per Chandler's feedback.

This goes with the earlier commit to remove the static destructor from ManagedStatic.cpp by controlling the allocation and de-allocation of the mutex.

Summary: This is part of the ongoing work to remove static constructors and destructors.

Reviewers: chandlerc, rnk

Reviewed By: rnk

Subscribers: rnk, llvm-commits

Differential Revision: http://reviews.llvm.org/D5473

Modified:
    llvm/trunk/include/llvm/Support/Threading.h

Modified: llvm/trunk/include/llvm/Support/Threading.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/Threading.h?rev=219640&r1=219639&r2=219640&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/Threading.h (original)
+++ llvm/trunk/include/llvm/Support/Threading.h Mon Oct 13 18:03:45 2014
@@ -38,12 +38,25 @@ namespace llvm {
   void llvm_execute_on_thread(void (*UserFn)(void*), void *UserData,
                               unsigned RequestedStackSize = 0);
 
+/// \brief Execute the function specified as a template parameter once.
+///
+/// Calls \p UserFn once ever. The call uniqueness is based on the address of
+/// the function passed in via the template arguement. This means no matter how
+/// many times you call llvm_call_once<foo>() in the same or different
+/// locations, foo will only be called once.
+///
+/// Typical usage:
+/// \code
+///   void foo() {...};
+///   ...
+///   llvm_call_once<foo>();
+/// \endcode
+///
+/// \param UserFn Function to call once.
 template <void (*UserFn)(void)> void llvm_call_once() {
-
 #if !defined(__MINGW__)
   static std::once_flag flag;
   std::call_once(flag, UserFn);
-
 #else
   struct InitOnceWrapper {
     InitOnceWrapper() { UserFn(); }





More information about the llvm-commits mailing list