ok
Direktori : /proc/self/root/proc/thread-self/root/proc/self/root/opt/alt/python27/lib64/python2.7/ |
Current File : //proc/self/root/proc/thread-self/root/proc/self/root/opt/alt/python27/lib64/python2.7/mutex.pyo |
� �[ bc @ sP d Z d d l m Z e d d d �[ d d l m Z d d d � � YZ d S( sK Mutual exclusion -- for use with module sched A mutex has two pieces of state -- a 'locked' bit and a queue. When the mutex is not locked, the queue is empty. Otherwise, the queue contains 0 or more (function, argument) pairs representing functions (or methods) waiting to acquire the lock. When the mutex is unlocked while the queue is not empty, the first queue entry is removed and its function(argument) pair called, implying it now has the lock. Of course, no multi-threading is implied -- hence the funny interface for lock, where a function is called once the lock is acquired. i����( t warnpy3ks/ the mutex module has been removed in Python 3.0t stackleveli ( t dequet mutexc B s5 e Z d � Z d � Z d � Z d � Z d � Z RS( c C s t | _ t � | _ d S( s) Create a new mutex -- initially unlocked.N( t Falset lockedR t queue( t self( ( s* /opt/alt/python27/lib64/python2.7/mutex.pyt __init__ s c C s | j S( s! Test the locked bit of the mutex.( R ( R ( ( s* /opt/alt/python27/lib64/python2.7/mutex.pyt test s c C s | j s t | _ t St Sd S( s[ Atomic test-and-set -- grab the lock if it is not set, return True if it succeeded.N( R t TrueR ( R ( ( s* /opt/alt/python27/lib64/python2.7/mutex.pyt testandset s c C s3 | j � r | | � n | j j | | f � d S( s� Lock a mutex, call the function with supplied argument when it is acquired. If the mutex is already locked, place function and argument in the queue.N( R R t append( R t functiont argument( ( s* /opt/alt/python27/lib64/python2.7/mutex.pyt lock'