提交 519ec8d5 authored 作者: Frederic Bastien's avatar Frederic Bastien

Don't take the lock if the cutil is well compiled.

上级 e552cf70
......@@ -1155,7 +1155,7 @@ class OpWiseCLinker(link.LocalLinker):
# compilation will be finished. This allow to don't
# require the lock when all c code are already compiled!
keep_lock=True
orig_n_lock = get_lock.n_lock
orig_n_lock = getattr(get_lock,"n_lock",0)
try:
env = self.env
......
......@@ -10,9 +10,17 @@ if os.path.exists(os.path.join(config.compiledir,'cutils_ext.so')):
# Ensure no-one else is currently modifying the content of the compilation
# directory. This is important to prevent multiple processes from trying to
# compile the cutils_ext module simultaneously.
get_lock()
try:
from cutils_ext.cutils_ext import *
except ImportError:
import cmodule
get_lock()
try:
try:
# We must retry to import it as some other processs could
# have been compiling it between the first failed import
# and when we receive the lock
from cutils_ext.cutils_ext import *
except ImportError:
import cmodule
......@@ -61,7 +69,6 @@ try:
cmodule.gcc_module_compile_str('cutils_ext', code, location=loc)
from cutils_ext.cutils_ext import *
finally:
finally:
# Release lock on compilation directory.
release_lock()
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论