Python has two GILs
reticulatingsplines.posterous.com
reticulatingsplines.posterous.com
It fixes several issues related to dead locks when a thread uses a
function that imports a module but another thread holds the lock. It
doesn't require static caching of modules.
The idea that deadlocks were a problem makes me think that this import lock isn't exactly 'global', per-se.Here is a quick rundown of how a deadlock can occur:
1. The main module runs in Thread #1, which imports module "foo".
2. Module "foo" has code at the top level that starts a new thread (Thread #2), and then blocks waiting for it to do something.
3. In Thread #2, someone calls datetime.strptime(). This deadlocks because now Thread #2 needs to import "_strptime" but Thread #1 holds the Global Import Lock because it is importing "foo".