This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author wenzel
Recipients docs@python, eric.snow, nanjekyejoannah, ncoghlan, vstinner, wenzel
Date 2019-09-24.12:19:09
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1569327549.78.0.240728467566.issue37878@roundup.psfhosted.org>
In-reply-to
Content
Hi,

pybind11 developer here. A bit on context of our usage of this function:

Pybind11 supports some advanced GIL-related tricks that *require* access this function. For instance, pybind11 can intercept a Python function call on the `main()` thread and delete the associated thread state, launching a new thread and continuing Python execution there (with a newly created thread state).

Kind of crazy, but why is this useful? UI libraries. On some platforms, it is not legal to poll UI events on any thread other than the main thread. This means that it's impossible to implement a proper UI event loop because Python is hogging the main thread. With the functionality in pybind11's ``gil_scoped_acquire``, I can launch an event polling loop on the main thread, continue running an interactive Python session on another thread, and even swap them back e.g. when the user interface is no longer needed.

Best,
Wenzel
History
Date User Action Args
2019-09-24 12:19:09wenzelsetrecipients: + wenzel, ncoghlan, vstinner, docs@python, eric.snow, nanjekyejoannah
2019-09-24 12:19:09wenzelsetmessageid: <1569327549.78.0.240728467566.issue37878@roundup.psfhosted.org>
2019-09-24 12:19:09wenzellinkissue37878 messages
2019-09-24 12:19:09wenzelcreate