Style fixes for Python threads documentation changes

This commit is contained in:
William S Fulton 2017-03-24 08:22:16 +00:00
commit d888fabc0c
2 changed files with 46 additions and 30 deletions

View file

@ -1614,6 +1614,11 @@
<li><a href="Python.html#Python_nn77">Byte string output conversion</a> <li><a href="Python.html#Python_nn77">Byte string output conversion</a>
<li><a href="Python.html#Python_2_unicode">Python 2 Unicode</a> <li><a href="Python.html#Python_2_unicode">Python 2 Unicode</a>
</ul> </ul>
<li><a href="Python.html#Python_multithreaded">Support for Multithreaded Applications</a>
<ul>
<li><a href="Python.html#Python_thread_UI">UI for Enabling Multithreading Support</a>
<li><a href="Python.html#Python_thread_performance">Multithread Performance</a>
</ul>
</ul> </ul>
</div> </div>
<!-- INDEX --> <!-- INDEX -->

View file

@ -2966,9 +2966,6 @@ class MyFoo(mymodule.Foo):
<H3><a name="Python_nn34">36.5.2 Director classes</a></H3> <H3><a name="Python_nn34">36.5.2 Director classes</a></H3>
<p> <p>
For each class that has directors enabled, SWIG generates a new class For each class that has directors enabled, SWIG generates a new class
that derives from both the class in question and a special that derives from both the class in question and a special
@ -6737,6 +6734,7 @@ prohibiting it.
<H2><a name="Python_multithreaded">36.13 Support for Multithreaded Applications</a></H2> <H2><a name="Python_multithreaded">36.13 Support for Multithreaded Applications</a></H2>
<p>By default, SWIG does not enable support for multithreaded Python applications. More <p>By default, SWIG does not enable support for multithreaded Python applications. More
specifically, the Python wrappers generated by SWIG will not release the specifically, the Python wrappers generated by SWIG will not release the
Python's interpreter's Global Interpreter Lock (GIL) when wrapped C/C++ code is Python's interpreter's Global Interpreter Lock (GIL) when wrapped C/C++ code is
@ -6751,43 +6749,56 @@ will not be able to run any other threads, even if the wrapped C/C++ code is wai
<H3><a name="Python_thread_UI">36.13.1 UI for Enabling Multithreading Support</a></H3> <H3><a name="Python_thread_UI">36.13.1 UI for Enabling Multithreading Support</a></H3>
<p>The user interface is as follows:</p> <p>The user interface is as follows:</p>
<ol> <ol>
<li>Module thread support can be enabled in two ways: <li><p>Module thread support can be enabled in two ways:</p>
<ul> <ul>
<li> <li>
The <b>-threads</b> swig python option at the command line (or in <tt>setup.py</tt>): <p>
<div class="shell">$ swig -python -threads example.i</div> The <tt>-threads</tt> swig python option at the command line (or in <tt>setup.py</tt>):
</li> </p>
<li> <div class="shell"><pre>$ swig -python -threads example.i</pre></div>
The <b>threads</b> module option in the *.i template file: </li>
<div class="code">%feature("nothread") method;</div> <li>
</li> <p>
</ul> The <tt>threads</tt> module option in the *.i template file:
</li> </p>
<li>You can disable thread support for a given method: <div class="code"><pre>%feature("nothread") method;</pre></div>
<div class="code">%module("threads"=1)<br><b>or</b><br>%nothread method;</div> </li>
</li> </ul>
<li>You can partially disable thread support for a given method: </li>
<ul> <li><p>You can disable thread support for a given method:</p>
<li> To disable the C++/python thread protection: <div class="code"><pre>%module("threads"=1)</pre></div>
<div class="code">%feature("nothreadblock") method;<br><b>or</b><br>%nothreadblock method;</div> or
</li> <div class="code"><pre>%nothread method;</pre></div>
<li> </li>
To disable the python/C++ thread protection <li><p>You can partially disable thread support for a given method:</p>
<div class="code">%feature("nothreadallow") method;<br><b>or</b><br>%nothreadallow method;</div> <ul>
</li> <li><p>To disable the C++/python thread protection:</p>
</ul> <div class="code"><pre>%feature("nothreadblock") method;</pre></div>
</li> or
<div class="code"><pre>%nothreadblock method;</pre></div>
</li>
<li>
<p>To disable the python/C++ thread protection</p>
<div class="code"><pre>%feature("nothreadallow") method;</pre></div>
or
<div class="code"><pre>%nothreadallow method;</pre></div>
</li>
</ul>
</li>
</ol> </ol>
<H3><a name="Python_thread_performance">36.13.2 Multithread Performance</a></H3> <H3><a name="Python_thread_performance">36.13.2 Multithread Performance</a></H3>
<p> <p>
For the curious about performance, here are some numbers for the profiletest.i test, For the curious about performance, here are some numbers for the profiletest.i test,
which is used to check the speed of the wrapped code: which is used to check the speed of the wrapped code:
</p> </p>
<table> <table summary="Python multithread performance">
<tr> <tr>
<th>Thread Mode</th> <th>Thread Mode</th>
<th>Execution Time (sec)</th> <th>Execution Time (sec)</th>