diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2018-07-25 11:42:39 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2018-07-25 12:16:31 +0000 |
commit | be202bd1baf600c7b422c96cc6b47a327e7a9d23 (patch) | |
tree | 187183f6636901b36c1e0c87708040c653b7d0fd /sources/shiboken2/ApiExtractor/doc/typesystem_manipulating_objects.rst | |
parent | fdae2fce386cb4d72c4528b7e868c61860c43069 (diff) |
shiboken: Fix the allow-thread attribute to actually have an effect
Previously, calls to BEGIN_ALLOW_THREADS/END_ALLOW_THREADS were always
generated since the value of XML attribute was not used.
Fix it to actually use the value. Since having it default to "no"
caused a number of deadlocks (related to thread functions or functions
calling a virtual function (potentially reimplemented in Python),
introduce "auto" as default value. "auto" turns off
BEGIN_ALLOW_THREADS/END_ALLOW_THREADS for simple getter functions.
Task-number: PYSIDE-743
Change-Id: I4833afef14f2552c75b3424417c2702ce25cb379
Reviewed-by: Christian Tismer <tismer@stackless.com>
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Diffstat (limited to 'sources/shiboken2/ApiExtractor/doc/typesystem_manipulating_objects.rst')
-rw-r--r-- | sources/shiboken2/ApiExtractor/doc/typesystem_manipulating_objects.rst | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/sources/shiboken2/ApiExtractor/doc/typesystem_manipulating_objects.rst b/sources/shiboken2/ApiExtractor/doc/typesystem_manipulating_objects.rst index ff6ea5317..2d0c40e20 100644 --- a/sources/shiboken2/ApiExtractor/doc/typesystem_manipulating_objects.rst +++ b/sources/shiboken2/ApiExtractor/doc/typesystem_manipulating_objects.rst @@ -74,6 +74,7 @@ modify-function since="..." remove="all | c++" access="public | private | protected" + allow-thread="true | auto | false" rename="..." /> </object-type> @@ -82,6 +83,15 @@ modify-function The ``since`` attribute specify the API version when this function was modified. + The ``allow-thread`` attribute specifies whether a function should be wrapped + into ``Py_BEGIN_ALLOW_THREADS`` and ``Py_END_ALLOW_THREADS``, that is, + temporarily release the GIL (global interpreter lock). Doing so is required + for any thread-related function (wait operations), functions that might call + a virtual function (potentially reimplemented in Python), and recommended for + lengthy I/O operations or similar. It has performance costs, though. + The value ``auto`` means that it will be turned off for functions for which + it is deemed to be safe, for example, simple getters. + The ``remove``, ``access`` and ``rename`` attributes are *optional* attributes for added convenience; they serve the same purpose as the deprecated tags :ref:`remove`, :ref:`access` and :ref:`rename`. |