| |
- __builtin__.object
-
- lock
- exceptions.Exception(exceptions.BaseException)
-
- error
LockType = class lock(__builtin__.object) |
|
A lock object is a synchronization primitive. To create a lock,
call the PyThread_allocate_lock() function. Methods are:
acquire() -- lock the lock, possibly blocking until it can be obtained
release() -- unlock of the lock
locked() -- test whether the lock is currently locked
A lock is not owned by the thread that locked it; another thread may
unlock it. A thread attempting to lock a lock that it has already locked
will block until another thread unlocks it. Deadlocks may ensue. |
|
Methods defined here:
- __enter__(...)
- acquire([wait]) -> None or bool
(acquire_lock() is an obsolete synonym)
Lock the lock. Without argument, this blocks if the lock is already
locked (even by the same thread), waiting for another thread to release
the lock, and return None once the lock is acquired.
With an argument, this will only block if the argument is true,
and the return value reflects whether the lock is acquired.
The blocking operation is not interruptible.
- __exit__(...)
- release()
(release_lock() is an obsolete synonym)
Release the lock, allowing another thread that is blocked waiting for
the lock to acquire the lock. The lock must be in the locked state,
but it needn't be locked by the same thread that unlocks it.
- acquire(...)
- acquire([wait]) -> None or bool
(acquire_lock() is an obsolete synonym)
Lock the lock. Without argument, this blocks if the lock is already
locked (even by the same thread), waiting for another thread to release
the lock, and return None once the lock is acquired.
With an argument, this will only block if the argument is true,
and the return value reflects whether the lock is acquired.
The blocking operation is not interruptible.
- acquire_lock(...)
- acquire([wait]) -> None or bool
(acquire_lock() is an obsolete synonym)
Lock the lock. Without argument, this blocks if the lock is already
locked (even by the same thread), waiting for another thread to release
the lock, and return None once the lock is acquired.
With an argument, this will only block if the argument is true,
and the return value reflects whether the lock is acquired.
The blocking operation is not interruptible.
- locked(...)
- locked() -> bool
(locked_lock() is an obsolete synonym)
Return whether the lock is in the locked state.
- locked_lock(...)
- locked() -> bool
(locked_lock() is an obsolete synonym)
Return whether the lock is in the locked state.
- release(...)
- release()
(release_lock() is an obsolete synonym)
Release the lock, allowing another thread that is blocked waiting for
the lock to acquire the lock. The lock must be in the locked state,
but it needn't be locked by the same thread that unlocks it.
- release_lock(...)
- release()
(release_lock() is an obsolete synonym)
Release the lock, allowing another thread that is blocked waiting for
the lock to acquire the lock. The lock must be in the locked state,
but it needn't be locked by the same thread that unlocks it.
|
|