[PyQt] Exception handling crash

Arve Knudsen arve.knudsen at gmail.com
Fri Jun 13 13:45:09 BST 2008


On 6/13/08, Phil Thompson <phil at riverbankcomputing.com> wrote:
> On Friday 13 June 2008 10:54:47 am Arve Knudsen wrote:
>  > Py_BEGIN_ALLOW_THREADS/Py_END_ALLOW_THREADS in the API:
>  > PyGILState_Ensure/PyGILState_Release. Could SIP make use of these
>  > functions instead?
>
>
> They are not alternatives. One pair frees the GIL for a period, the other
>  acquires the GIL for a period.

In order to free the GIL, you have to acquire it first no? Therefore,
BEGIN_ALLOW/END_ALLOW, should correspond to GILState_Release of a
previously Ensure'd GIL state and then a new call to
PyGILState_Ensure. Besides, the Python docs
(http://docs.python.org/api/threads.html) present the PyGILState_*
functions as a simpler alternative to Py_BEGIN_ALLOW_THREADS et al.

Arve


More information about the PyQt mailing list