Author: Armin Rigo <[email protected]>
Branch: stm-thread
Changeset: r54959:b7767f7919a3
Date: 2012-05-08 17:17 +0200
http://bitbucket.org/pypy/pypy/changeset/b7767f7919a3/
Log: Ah, found a possibly acceptable solution. To be tried out in real
life.
diff --git a/pypy/module/thread/stm.py b/pypy/module/thread/stm.py
--- a/pypy/module/thread/stm.py
+++ b/pypy/module/thread/stm.py
@@ -32,9 +32,14 @@
def acquire(self, flag):
if rstm.is_atomic():
- raise wrap_thread_error(self.space,
- "cannot acquire locks inside an atomic block")
- return ll_thread.Lock.acquire(self, flag)
+ acquired = ll_thread.Lock.acquire(self, False)
+ if flag and not acquired:
+ raise wrap_thread_error(self.space,
+ "deadlock: an atomic transaction tries to acquire "
+ "a lock that is already acquired. See http://XXX.")
+ else:
+ acquired = ll_thread.Lock.acquire(self, flag)
+ return acquired
def allocate_stm_lock(space):
return STMLock(space, ll_thread.allocate_ll_lock())
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit