提交 1c8a8433 authored 作者: Pascal Lamblin's avatar Pascal Lamblin

Acquire lock before creation of an empty directory.

That prevents other processes from deleting this dir while it is still empty, before the files are created in it. That problem caused intermittent failure of some tests.
上级 a31cfe4a
...@@ -390,6 +390,7 @@ class ModuleCache(object): ...@@ -390,6 +390,7 @@ class ModuleCache(object):
rval = self.module_from_name[name] rval = self.module_from_name[name]
else: else:
# we have never seen this key before # we have never seen this key before
compilelock.get_lock()
location = dlimport_workdir(self.dirname) location = dlimport_workdir(self.dirname)
#debug("LOCATION*", location) #debug("LOCATION*", location)
try: try:
...@@ -400,6 +401,8 @@ class ModuleCache(object): ...@@ -400,6 +401,8 @@ class ModuleCache(object):
#except Exception, ee: #except Exception, ee:
#error('failed to cleanup location', location, ee) #error('failed to cleanup location', location, ee)
raise raise
finally:
compilelock.release_lock()
name = module.__file__ name = module.__file__
debug("Adding module to cache", key, name) debug("Adding module to cache", key, name)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论