[Python-Dev] Reworking the GIL (original) (raw)

Antoine Pitrou solipsis at pitrou.net
Mon Oct 26 11:19:00 CET 2009


Terry Reedy <tjreedy udel.edu> writes:

I am curious as to whether the entire mechanism is or can be turned off when not needed -- when there are not threads (other than the main, starting thread)?

It is an implicit feature: when no thread is waiting on the GIL, the GIL-holding thread isn't notified and doesn't try to release it at all (in the eval loop, that is; GIL-releasing C extensions still release it).

Note that "no thread is waiting on the GIL" can mean one of two things:

So, yes, it automatically "turns itself off".

Regards

Antoine.



More information about the Python-Dev mailing list