Trees | Indices | Help |
|
---|
|
Implements a shared lock.
Multiple threads can acquire the lock in a shared way by calling
acquire(shared=1)
. In order to acquire the lock in an
exclusive way threads can call acquire(shared=0)
.
Notes on data structures: __pending
contains a priority
queue (heapq) of all pending acquires: [(priority1: prioqueue1),
(priority2: prioqueue2), ...]
. Each per-priority queue contains a
normal in-order list of conditions to be notified when the lock can be
acquired. Shared locks are grouped together by priority and the condition
for them is stored in __pending_shared
if it already exists.
__pending_by_prio
keeps references for the per-priority
queues indexed by priority for faster access.
|
|||
__condition_class |
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
int |
|
||
bool |
|
||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
Inherited from |
|
|||
string |
name the name of the lock |
|
|||
Inherited from |
|
Construct a new SharedLock.
|
Retrieves information for querying locks.
|
Is the current thread somehow owning the lock at this time? This is a private version of the function, which presumes you're holding the internal lock. |
Is the current thread somehow owning the lock at this time?
|
Is the current thread somehow owning the lock at this time?
|
Tries to find the topmost queued entry with pending acquires. Removes empty entries while going through the list. |
Checks whether the passed condition is on top of the queue. The caller must make sure the queue isn't empty. |
Acquire a shared lock.
|
Acquire a shared lock.
|
Changes the lock mode from exclusive to shared. Pending acquires in shared mode on the same priority will go ahead. |
Release a Shared Lock. You must have acquired the lock, either in shared or in exclusive mode, before calling this function. |
Delete a Shared Lock. This operation will declare the lock for removal. First the lock will be acquired in exclusive mode if you don't already own it, then the lock will be put in a state where any future and pending acquire() fail.
|
Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Tue Jul 24 16:51:26 2012 | http://epydoc.sourceforge.net |