ÿØÿàJFIFÿþ ÿÛC       ÿÛC ÿÀÿÄÿÄ"#QrÿÄÿÄ&1!A"2qQaáÿÚ ?Øy,æ/3JæÝ¹È߲؋5êXw²±ÉyˆR”¾I0ó2—PI¾IÌÚiMö¯–þrìN&"KgX:Šíµ•nTJnLK„…@!‰-ý ùúmë;ºgµŒ&ó±hw’¯Õ@”Ü— 9ñ-ë.²1<yà‚¹ïQÐU„ہ?.’¦èûbß±©Ö«Âw*VŒ) `$‰bØÔŸ’ëXÖ-ËTÜíGÚ3ð«g Ÿ§¯—Jx„–’U/ÂÅv_s(Hÿ@TñJÑãõçn­‚!ÈgfbÓc­:él[ðQe 9ÀPLbÃãCµm[5¿ç'ªjglå‡Ûí_§Úõl-;"PkÞÞÁQâ¼_Ñ^¢SŸx?"¸¦ùY騐ÒOÈ q’`~~ÚtËU¹CڒêV  I1Áß_ÿÙ ^Jc@svdZddlZddlZddlZyddlZWnek rYddlZnXyeje Z Wn7yddl Z e Z Wqek re Z qXnXddl mZddlmZddddd gZdefd YZejZd Zd Zd ZdefdYZdefdYZdefdYZdefdYZdS(sSynchronization functions. File- and mutex-based mutual exclusion synchronizers are provided, as well as a name-based mutex which locks within an application based on a string name. iN(tutil(t LockErrortfile_synchronizertmutex_synchronizertnull_synchronizertNameLockt _threadingcBsTeZdZejZdefdYZde dZ e dZ dZ RS(sa proxy for an RLock object that is stored in a name based registry. Multiple threads can get a reference to the same RLock based on the name alone, and synchronize operations related to that name. t NLContainercBseZdZdZRS(cCs+|rtj|_ntj|_dS(N(RtRLocktlocktLock(tselft reentrant((sG/opt/alt/python27/lib/python2.7/site-packages/beaker/synchronization.pyt__init__/scCs|jS(N(R (R ((sG/opt/alt/python27/lib/python2.7/site-packages/beaker/synchronization.pyt__call__4s(t__name__t __module__R R(((sG/opt/alt/python27/lib/python2.7/site-packages/beaker/synchronization.pyR.s cCsC|dkr!tj||_ntjj|tj||_dS(N(tNoneRRt_locktlockstget(R t identifierR ((sG/opt/alt/python27/lib/python2.7/site-packages/beaker/synchronization.pyR 7s cCs|jj|S(N(Rtacquire(R twait((sG/opt/alt/python27/lib/python2.7/site-packages/beaker/synchronization.pyR>scCs|jjdS(N(Rtrelease(R ((sG/opt/alt/python27/lib/python2.7/site-packages/beaker/synchronization.pyRAsN(RRt__doc__RtWeakValuedRegistryRtobjectRRtFalseR tTrueRR(((sG/opt/alt/python27/lib/python2.7/site-packages/beaker/synchronization.pyR$s    cKstj||f|||S(N(t_synchronizerstsync_get(Rtclstkwargs((sG/opt/alt/python27/lib/python2.7/site-packages/beaker/synchronization.pyt _synchronizerFscKs1t sd|krt|St|t|SdS(Ntlock_dir(t has_flockRR"tFileSynchronizer(RR!((sG/opt/alt/python27/lib/python2.7/site-packages/beaker/synchronization.pyRJs cKst|t|S(N(R"tConditionSynchronizer(RR!((sG/opt/alt/python27/lib/python2.7/site-packages/beaker/synchronization.pyRQscBs;eZedZdZdZdZeZeZRS(cCstS(N(R(R R((sG/opt/alt/python27/lib/python2.7/site-packages/beaker/synchronization.pytacquire_write_lockVscCsdS(N((R ((sG/opt/alt/python27/lib/python2.7/site-packages/beaker/synchronization.pytacquire_read_lockXscCsdS(N((R ((sG/opt/alt/python27/lib/python2.7/site-packages/beaker/synchronization.pytrelease_write_lockZscCsdS(N((R ((sG/opt/alt/python27/lib/python2.7/site-packages/beaker/synchronization.pytrelease_read_lock\s( RRRR'R(R)R*RR(((sG/opt/alt/python27/lib/python2.7/site-packages/beaker/synchronization.pyRUs     tSynchronizerImplcBseZdZdefdYZdZeeZdZedZ dZ e Z edZ e Z dZd Zd Zd ZRS( cCstj|_dS(N(Rt ThreadLocalt_state(R ((sG/opt/alt/python27/lib/python2.7/site-packages/beaker/synchronization.pyR cst SyncStatecBseZdZdZRS(treentrantcounttwritingtreadingcCsd|_t|_t|_dS(Ni(R/RR0R1(R ((sG/opt/alt/python27/lib/python2.7/site-packages/beaker/synchronization.pyR is  (R/R0R1(RRt __slots__R (((sG/opt/alt/python27/lib/python2.7/site-packages/beaker/synchronization.pyR.fscCs@|jjs/tj}|jj||S|jjSdS(N(R-thasR+R.tputR(R tstate((sG/opt/alt/python27/lib/python2.7/site-packages/beaker/synchronization.pyR5ns  cCsq|j}|jr!tdn|js9tdn|jdkr^|jt|_n|jd8_dS(Nslock is in writing stateslock is not in reading statei(R5R0RR1R/tdo_release_read_lockR(R R5((sG/opt/alt/python27/lib/python2.7/site-packages/beaker/synchronization.pyR*ws     cCs|j}|jr!tdn|jdkrj|j|}|sK|rf|jd7_t|_n|S|jr|jd7_tSdS(Nslock is in writing stateii(R5R0RR/tdo_acquire_read_lockRR1(R RR5tx((sG/opt/alt/python27/lib/python2.7/site-packages/beaker/synchronization.pyR(s     cCsq|j}|jr!tdn|js9tdn|jdkr^|jt|_n|jd8_dS(Nslock is in reading stateslock is not in writing statei(R5R1RR0R/tdo_release_write_lockR(R R5((sG/opt/alt/python27/lib/python2.7/site-packages/beaker/synchronization.pyR)s     cCs|j}|jr!tdn|jdkrj|j|}|sK|rf|jd7_t|_n|S|jr|jd7_tSdS(Nslock is in reading stateii(R5R1RR/tdo_acquire_write_lockRR0(R RR5R8((sG/opt/alt/python27/lib/python2.7/site-packages/beaker/synchronization.pyR's     cCs tdS(N(tNotImplementedError(R ((sG/opt/alt/python27/lib/python2.7/site-packages/beaker/synchronization.pyR6scCs tdS(N(R;(R ((sG/opt/alt/python27/lib/python2.7/site-packages/beaker/synchronization.pyR7scCs tdS(N(R;(R ((sG/opt/alt/python27/lib/python2.7/site-packages/beaker/synchronization.pyR9scCs tdS(N(R;(R ((sG/opt/alt/python27/lib/python2.7/site-packages/beaker/synchronization.pyR:s(RRR RR.R5tpropertyR*RR(R)RR'RR6R7R9R:(((sG/opt/alt/python27/lib/python2.7/site-packages/beaker/synchronization.pyR+bs          R%cBsbeZdZdZdZeeZdZdZdZdZ dZ dZ RS( sa synchronizer which locks using flock(). Adapted for Python/multithreads from Apache::Session::Lock::File, http://search.cpan.org/src/CWEST/Apache-Session-1.81/Session/Lock/File.pm This module does not unlink temporary files, because it interferes with proper locking. This can cause problems on certain systems (Linux) whose file systems (ext2) do not perform well with lots of files in one directory. To prevent this you should use a script to clean out old files from your lock directory. cCsett|jtj|_|dkr=tj}n|}tj ||gdd|_ dS(Nt extensions.lock( tsuperR%R RR,t_filedescriptorRttempfilet gettempdirt encoded_pathtfilename(R RR#((sG/opt/alt/python27/lib/python2.7/site-packages/beaker/synchronization.pyR s  cCs |jjS(N(R?R(R ((sG/opt/alt/python27/lib/python2.7/site-packages/beaker/synchronization.pyt _filedescscCsA|j}|dkr=tj|j|}|jj|n|S(N(RDRtostopenRCR?R4(R tmodetfiledescriptor((sG/opt/alt/python27/lib/python2.7/site-packages/beaker/synchronization.pyt_opens   cCs|jtjtjB}|ssy"tj|tjtjBtSWqt k rotj ||j j t SXntj|tjtSdS(N(RIREtO_CREATtO_RDONLYtfcntltflocktLOCK_SHtLOCK_NBRtIOErrortcloseR?tremoveR(R RRH((sG/opt/alt/python27/lib/python2.7/site-packages/beaker/synchronization.pyR7s   cCs|jtjtjB}|ssy"tj|tjtjBtSWqt k rotj ||j j t SXntj|tjtSdS(N(RIRERJtO_WRONLYRLRMtLOCK_EXRORRPRQR?RRR(R RRH((sG/opt/alt/python27/lib/python2.7/site-packages/beaker/synchronization.pyR:s   cCs|jdS(N(t_release_all_locks(R ((sG/opt/alt/python27/lib/python2.7/site-packages/beaker/synchronization.pyR6scCs|jdS(N(RU(R ((sG/opt/alt/python27/lib/python2.7/site-packages/beaker/synchronization.pyR9 scCsI|j}|dk rEtj|tjtj||jjndS(N( RDRRLRMtLOCK_UNRERQR?RR(R RH((sG/opt/alt/python27/lib/python2.7/site-packages/beaker/synchronization.pyRU s    ( RRRR RDR<RIR7R:R6R9RU(((sG/opt/alt/python27/lib/python2.7/site-packages/beaker/synchronization.pyR%s         R&cBsAeZdZdZedZdZedZdZRS(s!a synchronizer using a Condition.cCsAtt|jd|_d|_tjtj|_ dS(Ni( R>R&R tasyncRtcurrent_sync_operationRt ConditionR t condition(R R((sG/opt/alt/python27/lib/python2.7/site-packages/beaker/synchronization.pyR s  cCs~|jjzR|r<x6|jdk r8|jjqWn|jdk rOtS|jd7_Wd|jjX|sztSdS(Ni( RZRRXRRRRWRR(R R((sG/opt/alt/python27/lib/python2.7/site-packages/beaker/synchronization.pyR7$s cCs|jjzb|jd8_|jdkrP|jdk rn|jjqnn|jdkrntdnWd|jjXdS(Niis7Synchronizer error - too many release_read_locks called(RZRRWRXRt notifyAllRR(R ((sG/opt/alt/python27/lib/python2.7/site-packages/beaker/synchronization.pyR68s cCs|jjz|r<x6|jdk r8|jjqWn|jdk rOtStj|_|jdkr|r|jjqd|_tSnWd|jj X|st SdS(Ni( RZRRXRRRRt currentThreadRWRR(R R((sG/opt/alt/python27/lib/python2.7/site-packages/beaker/synchronization.pyR:Js    cCs`|jjz>|jtjk r4tdnd|_|jjWd|jjXdS(Ns>Synchronizer error - current thread doesnt have the write lock( RZRRXRR\RRR[R(R ((sG/opt/alt/python27/lib/python2.7/site-packages/beaker/synchronization.pyR9ns  ( RRRR RR7R6R:R9(((sG/opt/alt/python27/lib/python2.7/site-packages/beaker/synchronization.pyR&s    $(RREtsysR@t threadingRt ImportErrortdummy_threadingtgetwindowsversionRR$RLRtbeakerRtbeaker.exceptionsRt__all__RRRRR"RRRR+R%R&(((sG/opt/alt/python27/lib/python2.7/site-packages/beaker/synchronization.pyts:           !     bQ