[pypy-commit] pypy semlock-deadlock: add a test that hangs with SemLock (issue 2953)
mattip
pypy.commits at gmail.com
Tue Apr 23 09:00:42 EDT 2019
Author: Matti Picus <matti.picus at gmail.com>
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]
More information about the pypy-commit
mailing list