A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2002-December/031437.html below:

[Python-Dev] Extension modules, Threading, and the GIL

[Python-Dev] Extension modules, Threading, and the GIL"Martin v. Löwis" martin@v.loewis.de
Mon, 30 Dec 2002 08:15:31 +0100
David Abrahams wrote:
> Python extension module B calls shared library Q and uses Q's callback
> interface.  Because some of the callbacks need to use the Python API,
> and *might* be invoked by threads, they must all acquire the GIL.

Wrong. If the code in B that calls Q does not allow threads, the 
callbacks don't need to reacquire the GIL.

> Problem: using B while A is loaded breaks A: because B has installed
> callbacks in Q that acquire the GIL, A must also release the GIL
> before calling into Q.

Can you please explain what a callback is? Can the callbacks occur in 
the context of a different thread, i.e. different from the one that has 
installed the callback?

If it is a true callback (i.e. Q will call B back while being called 
from B), then this won't interfere at all with A.

Regards,
Martin




RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4