From d888fabc0ce223873e574414595776c65ca42a73 Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Fri, 24 Mar 2017 08:22:16 +0000 Subject: [PATCH] Style fixes for Python threads documentation changes --- Doc/Manual/Contents.html | 5 +++ Doc/Manual/Python.html | 71 +++++++++++++++++++++++----------------- 2 files changed, 46 insertions(+), 30 deletions(-) diff --git a/Doc/Manual/Contents.html b/Doc/Manual/Contents.html index f196da53c..56afca857 100644 --- a/Doc/Manual/Contents.html +++ b/Doc/Manual/Contents.html @@ -1614,6 +1614,11 @@
  • Byte string output conversion
  • Python 2 Unicode +
  • Support for Multithreaded Applications + diff --git a/Doc/Manual/Python.html b/Doc/Manual/Python.html index c0a7911d1..92488413e 100644 --- a/Doc/Manual/Python.html +++ b/Doc/Manual/Python.html @@ -2966,9 +2966,6 @@ class MyFoo(mymodule.Foo):

    36.5.2 Director classes

    - - -

    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.

    36.13 Support for Multithreaded Applications

    +

    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

    36.13.1 UI for Enabling Multithreading Support

    +

    The user interface is as follows:

      -
    1. Module thread support can be enabled in two ways: -
        -
      • - The -threads swig python option at the command line (or in setup.py): -
        $ swig -python -threads example.i
        -
      • -
      • - The threads module option in the *.i template file: -
        %feature("nothread") method;
        -
      • -
      -
    2. -
    3. You can disable thread support for a given method: -
      %module("threads"=1)
      or
      %nothread method;
      -
    4. -
    5. You can partially disable thread support for a given method: -
        -
      • To disable the C++/python thread protection: -
        %feature("nothreadblock") method;
        or
        %nothreadblock method;
        -
      • -
      • - To disable the python/C++ thread protection -
        %feature("nothreadallow") method;
        or
        %nothreadallow method;
        -
      • -
      -
    6. +
    7. Module thread support can be enabled in two ways:

      +
        +
      • +

        + The -threads swig python option at the command line (or in setup.py): +

        +
        $ swig -python -threads example.i
        +
      • +
      • +

        + The threads module option in the *.i template file: +

        +
        %feature("nothread") method;
        +
      • +
      +
    8. +
    9. You can disable thread support for a given method:

      +
      %module("threads"=1)
      + or +
      %nothread method;
      +
    10. +
    11. You can partially disable thread support for a given method:

      +
        +
      • To disable the C++/python thread protection:

        +
        %feature("nothreadblock") method;
        + or +
        %nothreadblock method;
        +
      • +
      • +

        To disable the python/C++ thread protection

        +
        %feature("nothreadallow") method;
        + or +
        %nothreadallow method;
        +
      • +
      +

    36.13.2 Multithread Performance

    + +

    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:

    - +
    Thread Mode Execution Time (sec)