summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2011-01-13 06:14:18 -0800
committerZac Medico <zmedico@gentoo.org>2011-01-16 12:33:04 -0800
commit7d10b0bbc1a3424bdd60264c0153b7eadb14b328 (patch)
treec6db13177c939792c6763cd9c3e5a58e103a0e53
parent6cd3e7322921667d893ffe86c025a1b09d010586 (diff)
downloadportage-7d10b0bbc1a3424bdd60264c0153b7eadb14b328.tar.gz
portage-7d10b0bbc1a3424bdd60264c0153b7eadb14b328.tar.bz2
portage-7d10b0bbc1a3424bdd60264c0153b7eadb14b328.zip
AsynchronousLock: use process by default
The default behavior is to use a process instead of a thread, since there is currently no way to interrupt a thread that is waiting for a lock (notably, SIGINT doesn't work because python delivers all signals to the main thread).
-rw-r--r--pym/_emerge/AsynchronousLock.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/pym/_emerge/AsynchronousLock.py b/pym/_emerge/AsynchronousLock.py
index fe9d36210..863c88b6a 100644
--- a/pym/_emerge/AsynchronousLock.py
+++ b/pym/_emerge/AsynchronousLock.py
@@ -23,12 +23,19 @@ class AsynchronousLock(AsynchronousTask):
"""
This uses the portage.locks module to acquire a lock asynchronously,
using either a thread (if available) or a subprocess.
+
+ The default behavior is to use a process instead of a thread, since
+ there is currently no way to interrupt a thread that is waiting for
+ a lock (notably, SIGINT doesn't work because python delivers all
+ signals to the main thread).
"""
__slots__ = ('path', 'scheduler',) + \
('_imp', '_force_async', '_force_dummy', '_force_process', \
'_force_thread', '_waiting')
+ _use_process_by_default = True
+
def _start(self):
if not self._force_async:
@@ -43,7 +50,8 @@ class AsynchronousLock(AsynchronousTask):
return
if self._force_process or \
- (not self._force_thread and threading is dummy_threading):
+ (not self._force_thread and \
+ (self._use_process_by_default or threading is dummy_threading)):
self._imp = _LockProcess(path=self.path, scheduler=self.scheduler)
else:
self._imp = _LockThread(path=self.path,