mirror of
https://github.com/python/cpython.git
synced 2025-07-29 14:15:07 +00:00
revert r66114 for Jesse
This commit is contained in:
parent
27cc8e1dd2
commit
f7feaec16c
5 changed files with 146 additions and 39 deletions
|
@ -65,9 +65,7 @@ class SemLock(object):
|
|||
#
|
||||
|
||||
class Semaphore(SemLock):
|
||||
'''
|
||||
A semaphore object
|
||||
'''
|
||||
|
||||
def __init__(self, value=1):
|
||||
SemLock.__init__(self, SEMAPHORE, value, SEM_VALUE_MAX)
|
||||
|
||||
|
@ -86,9 +84,7 @@ class Semaphore(SemLock):
|
|||
#
|
||||
|
||||
class BoundedSemaphore(Semaphore):
|
||||
'''
|
||||
A bounded semaphore object
|
||||
'''
|
||||
|
||||
def __init__(self, value=1):
|
||||
SemLock.__init__(self, SEMAPHORE, value, value)
|
||||
|
||||
|
@ -105,9 +101,7 @@ class BoundedSemaphore(Semaphore):
|
|||
#
|
||||
|
||||
class Lock(SemLock):
|
||||
'''
|
||||
A non-recursive lock object
|
||||
'''
|
||||
|
||||
def __init__(self):
|
||||
SemLock.__init__(self, SEMAPHORE, 1, 1)
|
||||
|
||||
|
@ -132,9 +126,7 @@ class Lock(SemLock):
|
|||
#
|
||||
|
||||
class RLock(SemLock):
|
||||
'''
|
||||
A recursive lock object
|
||||
'''
|
||||
|
||||
def __init__(self):
|
||||
SemLock.__init__(self, RECURSIVE_MUTEX, 1, 1)
|
||||
|
||||
|
@ -160,9 +152,6 @@ class RLock(SemLock):
|
|||
#
|
||||
|
||||
class Condition(object):
|
||||
'''
|
||||
A condition object
|
||||
'''
|
||||
|
||||
def __init__(self, lock=None):
|
||||
self._lock = lock or RLock()
|
||||
|
@ -263,9 +252,7 @@ class Condition(object):
|
|||
#
|
||||
|
||||
class Event(object):
|
||||
'''
|
||||
An event object
|
||||
'''
|
||||
|
||||
def __init__(self):
|
||||
self._cond = Condition(Lock())
|
||||
self._flag = Semaphore(0)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue