Author: Matti Picus <[email protected]>
Branch: semlock-deadlock
Changeset: r96540:09ebb064a7b8
Date: 2019-04-23 15:33 +0300
http://bitbucket.org/pypy/pypy/changeset/09ebb064a7b8/

Log:    add a test that hangs with SemLock (issue 2953)

diff --git a/pypy/module/_multiprocessing/test/test_semaphore.py 
b/pypy/module/_multiprocessing/test/test_semaphore.py
--- a/pypy/module/_multiprocessing/test/test_semaphore.py
+++ b/pypy/module/_multiprocessing/test/test_semaphore.py
@@ -108,3 +108,15 @@
         with sem:
             assert sem._count() == 1
         assert sem._count() == 0
+
+    def test_in_threads(self):
+        from _multiprocessing import SemLock
+        from threading import Thread
+        l = SemLock(0, 1, 1)
+        def f():
+            for i in range(10000):
+                with l:
+                    pass
+        threads = [Thread(None, f) for i in range(2)]
+        [t.start() for t in threads]
+        [t.join() for t in threads]
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to