Message110287
This is an implementation of the idea suggested in:
http://mail.python.org/pipermail/python-dev/2003-February/033445.html
The patch creates a dictionary of reentrant locks keyed by module full name. Trying to import a module or package will first get the lock for that module (or, if necessary, create it) and then acquire it. This is done for any module type.
The global import lock is still there, but only used for two things:
- serializing first time creation of module-specific locks
- protection of imports based on import hooks, since we don't know whether third-party import hooks are themselves thread-safe
Semantics of the public C API are unchanged, because it is not clear whether they should be or not (concerns of usefulness vs. compatibility). For example, PyImport_ImportModuleNoBlock() still uses the global import lock but this could be relaxed in a later patch. |
|
Date |
User |
Action |
Args |
2010-07-14 14:44:24 | pitrou | set | recipients:
+ pitrou, gvanrossum, brett.cannon, ncoghlan, christian.heimes, grahamd |
2010-07-14 14:44:23 | pitrou | set | messageid: <1279118663.3.0.514954672422.issue9260@psf.upfronthosting.co.za> |
2010-07-14 14:44:20 | pitrou | link | issue9260 messages |
2010-07-14 14:44:19 | pitrou | create | |
|