mirror of
https://github.com/python/cpython.git
synced 2025-10-09 16:34:44 +00:00
Issue #3001: Add a C implementation of recursive locks which is used by
default when instantiating a `Threading.RLock` object. This makes recursive locks as fast as regular non-recursive locks (previously, they were slower by 10x to 15x).
This commit is contained in:
parent
0e31201848
commit
434736a1a6
4 changed files with 296 additions and 5 deletions
|
@ -506,8 +506,11 @@ class ThreadingExceptionTests(BaseTestCase):
|
|||
class LockTests(lock_tests.LockTests):
|
||||
locktype = staticmethod(threading.Lock)
|
||||
|
||||
class RLockTests(lock_tests.RLockTests):
|
||||
locktype = staticmethod(threading.RLock)
|
||||
class PyRLockTests(lock_tests.RLockTests):
|
||||
locktype = staticmethod(threading._PyRLock)
|
||||
|
||||
class CRLockTests(lock_tests.RLockTests):
|
||||
locktype = staticmethod(threading._CRLock)
|
||||
|
||||
class EventTests(lock_tests.EventTests):
|
||||
eventtype = staticmethod(threading.Event)
|
||||
|
@ -527,7 +530,7 @@ class BoundedSemaphoreTests(lock_tests.BoundedSemaphoreTests):
|
|||
|
||||
|
||||
def test_main():
|
||||
test.support.run_unittest(LockTests, RLockTests, EventTests,
|
||||
test.support.run_unittest(LockTests, PyRLockTests, CRLockTests, EventTests,
|
||||
ConditionAsRLockTests, ConditionTests,
|
||||
SemaphoreTests, BoundedSemaphoreTests,
|
||||
ThreadTests,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue