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

@ -2966,9 +2966,6 @@ class MyFoo(mymodule.Foo):
<H3><a name="Python_nn34">36.5.2 Director classes</a></H3>
<p>
For each class that has directors enabled, SWIG generates a new class
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>
<p>By default, SWIG does not enable support for multithreaded Python applications. More
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
@ -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>
<p>The user interface is as follows:</p>
<ol>
<li>Module thread support can be enabled in two ways:
<ul>
<li>
The <b>-threads</b> swig python option at the command line (or in <tt>setup.py</tt>):
<div class="shell">$ swig -python -threads example.i</div>
</li>
<li>
The <b>threads</b> module option in the *.i template file:
<div class="code">%feature("nothread") method;</div>
</li>
</ul>
</li>
<li>You can disable thread support for a given method:
<div class="code">%module("threads"=1)<br><b>or</b><br>%nothread method;</div>
</li>
<li>You can partially disable thread support for a given method:
<ul>
<li> To disable the C++/python thread protection:
<div class="code">%feature("nothreadblock") method;<br><b>or</b><br>%nothreadblock method;</div>
</li>
<li>
To disable the python/C++ thread protection
<div class="code">%feature("nothreadallow") method;<br><b>or</b><br>%nothreadallow method;</div>
</li>
</ul>
</li>
<li><p>Module thread support can be enabled in two ways:</p>
<ul>
<li>
<p>
The <tt>-threads</tt> swig python option at the command line (or in <tt>setup.py</tt>):
</p>
<div class="shell"><pre>$ swig -python -threads example.i</pre></div>
</li>
<li>
<p>
The <tt>threads</tt> module option in the *.i template file:
</p>
<div class="code"><pre>%feature("nothread") method;</pre></div>
</li>
</ul>
</li>
<li><p>You can disable thread support for a given method:</p>
<div class="code"><pre>%module("threads"=1)</pre></div>
or
<div class="code"><pre>%nothread method;</pre></div>
</li>
<li><p>You can partially disable thread support for a given method:</p>
<ul>
<li><p>To disable the C++/python thread protection:</p>
<div class="code"><pre>%feature("nothreadblock") method;</pre></div>
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>
<H3><a name="Python_thread_performance">36.13.2 Multithread Performance</a></H3>
<p>
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:
</p>
<table>
<table summary="Python multithread performance">
<tr>
<th>Thread Mode</th>
<th>Execution Time (sec)</th>