<div dir="ltr">This change was reverted in r211072 due to accidentally pushing a whole branch instead of a single CL.<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Jun 16, 2014 at 3:40 PM, Zachary Turner <span dir="ltr"><<a href="mailto:zturner@google.com" target="_blank">zturner@google.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: zturner<br>
Date: Mon Jun 16 17:40:48 2014<br>
New Revision: 211070<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=211070&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=211070&view=rev</a><br>
Log:<br>
Programmer's Manual changes.<br>
<br>
Modified:<br>
llvm/trunk/docs/ProgrammersManual.rst<br>
<br>
Modified: llvm/trunk/docs/ProgrammersManual.rst<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/ProgrammersManual.rst?rev=211070&r1=211069&r2=211070&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/ProgrammersManual.rst?rev=211070&r1=211069&r2=211070&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/docs/ProgrammersManual.rst (original)<br>
+++ llvm/trunk/docs/ProgrammersManual.rst Mon Jun 16 17:40:48 2014<br>
@@ -2170,67 +2170,24 @@ compiler, consider compiling LLVM and LL<br>
using the resultant compiler to build a copy of LLVM with multithreading<br>
support.<br>
<br>
-.. _startmultithreaded:<br>
-<br>
-Entering and Exiting Multithreaded Mode<br>
----------------------------------------<br>
-<br>
-In order to properly protect its internal data structures while avoiding<br>
-excessive locking overhead in the single-threaded case, the LLVM must intialize<br>
-certain data structures necessary to provide guards around its internals. To do<br>
-so, the client program must invoke ``llvm_start_multithreaded()`` before making<br>
-any concurrent LLVM API calls. To subsequently tear down these structures, use<br>
-the ``llvm_stop_multithreaded()`` call. You can also use the<br>
-``llvm_is_multithreaded()`` call to check the status of multithreaded mode.<br>
-<br>
-Note that both of these calls must be made *in isolation*. That is to say that<br>
-no other LLVM API calls may be executing at any time during the execution of<br>
-``llvm_start_multithreaded()`` or ``llvm_stop_multithreaded``. It is the<br>
-client's responsibility to enforce this isolation.<br>
-<br>
-The return value of ``llvm_start_multithreaded()`` indicates the success or<br>
-failure of the initialization. Failure typically indicates that your copy of<br>
-LLVM was built without multithreading support, typically because GCC atomic<br>
-intrinsics were not found in your system compiler. In this case, the LLVM API<br>
-will not be safe for concurrent calls. However, it *will* be safe for hosting<br>
-threaded applications in the JIT, though :ref:`care must be taken<br>
-<jitthreading>` to ensure that side exits and the like do not accidentally<br>
-result in concurrent LLVM API calls.<br>
-<br>
.. _shutdown:<br>
<br>
Ending Execution with ``llvm_shutdown()``<br>
-----------------------------------------<br>
<br>
When you are done using the LLVM APIs, you should call ``llvm_shutdown()`` to<br>
-deallocate memory used for internal structures. This will also invoke<br>
-``llvm_stop_multithreaded()`` if LLVM is operating in multithreaded mode. As<br>
-such, ``llvm_shutdown()`` requires the same isolation guarantees as<br>
-``llvm_stop_multithreaded()``.<br>
-<br>
-Note that, if you use scope-based shutdown, you can use the<br>
-``llvm_shutdown_obj`` class, which calls ``llvm_shutdown()`` in its destructor.<br>
-<br>
+deallocate memory used for internal structures.<br>
.. _managedstatic:<br>
<br>
Lazy Initialization with ``ManagedStatic``<br>
------------------------------------------<br>
<br>
``ManagedStatic`` is a utility class in LLVM used to implement static<br>
-initialization of static resources, such as the global type tables. Before the<br>
-invocation of ``llvm_shutdown()``, it implements a simple lazy initialization<br>
-scheme. Once ``llvm_start_multithreaded()`` returns, however, it uses<br>
+initialization of static resources, such as the global type tables. In a<br>
+single-threaded environment, it implements a simple lazy initialization scheme.<br>
+When LLVM is compiled with support for multi-threading, however, it uses<br>
double-checked locking to implement thread-safe lazy initialization.<br>
<br>
-Note that, because no other threads are allowed to issue LLVM API calls before<br>
-``llvm_start_multithreaded()`` returns, it is possible to have<br>
-``ManagedStatic``\ s of ``llvm::sys::Mutex``\ s.<br>
-<br>
-The ``llvm_acquire_global_lock()`` and ``llvm_release_global_lock`` APIs provide<br>
-access to the global lock used to implement the double-checked locking for lazy<br>
-initialization. These should only be used internally to LLVM, and only if you<br>
-know what you're doing!<br>
-<br>
.. _llvmcontext:<br>
<br>
Achieving Isolation with ``LLVMContext``<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br></div>