[IronPython] importing on different threads

Kamil Dworakowski kamil at dworakowski.name
Thu Aug 21 14:11:08 CEST 2008


We are trying parallel imports, which somtimes fail with ImportError (ipy
1.1.1). This happens when one thread attempts to import a module which is
being imported on a different thread. The number of such risky imports is
not high, and we deal with this by catching the exception and retrying.

What do you think? Is it a wrong thing to do? I would like to avoid locking.


I have just glimpsed over the IronPython source. Does the problem here is
that when one thread starts to import a module it inserts an emty entry into
sys.modules, thus other threads get None (or ImportError when using "import
from" statement) until the module is fully imported?

Kamil Dworakowski
Resolver Systems Ltd
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20080821/b443d08d/attachment.html>


More information about the Ironpython-users mailing list