KGRKJGETMRETU895U-589TY5MIGM5JGB5SDFESFREWTGR54TY
Server : Apache/2.2.17 (Unix) mod_ssl/2.2.17 OpenSSL/0.9.8e-fips-rhel5 DAV/2 PHP/5.2.17
System : Linux localhost 2.6.18-419.el5 #1 SMP Fri Feb 24 22:47:42 UTC 2017 x86_64
User : nobody ( 99)
PHP Version : 5.2.17
Disable Function : NONE
Directory :  /proc/21572/root/usr/lib64/python2.4/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //proc/21572/root/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


Anon7 - 2021