I was wondering the interaction that wxPython has with running things on separate cores and if wxPython releases the GIL when running.
I've assumed that when I kick off some command which takes a while that wxPython
starts up the wxWidgets
c++ code which runs on multiple cores
and somehow releases the GIL
until the task is finished and then comes back. However I have nothing to base this on. Does this ever happen?
What is actually going on under the hood?
The GIL is automatically released and reacquired whenever a call is made to a wx C++ function or method. This is probably a bit of overkill as there are a number of things that are quick and won't ever block and it might be more efficient to not release/reacquire the GIL, but this approach ensures that we don't miss doing it for something that will block.
In addition, any time there is an event dispatched to a Python event handler, or when a virtual method overridden in Python is called, or etc. then the GIL is acquired before entry to that code and released again afterwards.