MOON
Server: Apache/2.2.21 (Unix) mod_ssl/2.2.21 OpenSSL/0.9.8e-fips-rhel5 mod_auth_passthrough/2.1 mod_bwlimited/1.4
System: Linux vps.panamaemb.org.sg 3.10.0-1160.80.1.vz7.191.4 #1 SMP Thu Dec 15 20:31:06 MSK 2022 x86_64
User: panama (500)
PHP: 5.2.17
Disabled: NONE
Upload Files
File: //proc/3/cwd/usr/lib64/python2.4/mutex.pyo
mò
‚=5Dc@s*dZdklZdfd„ƒYZdS(sJMutual 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 aquired.
(sdequetmutexcBs5tZd„Zd„Zd„Zd„Zd„ZRS(NcCsd|_tƒ|_dS(s)Create a new mutex -- initially unlocked.iN(tselftlockedtdequetqueue(R((t/usr/lib64/python2.4/mutex.pyt__init__s	cCs|iS(s!Test the locked bit of the mutex.N(RR(R((RttestscCs#|ipd|_tSntSdS(s[Atomic test-and-set -- grab the lock if it is not set,
        return True if it succeeded.iN(RRtTruetFalse(R((Rt
testandsets

	cCs5|iƒo||ƒn|ii||fƒdS(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(RR
tfunctiontargumentRtappend(RRR((Rtlock$s
cCs:|io#|iiƒ\}}||ƒn
d|_dS(s]Unlock a mutex.  If the queue is not empty, call the next
        function with its argument.iN(RRtpopleftRRR(RRR((Rtunlock-s

(t__name__t
__module__RRR
RR(((RRs
						N(t__doc__tcollectionsRR(RR((Rt?
s