ó û^‚Rc@sœddddddgZddlZddlZddlZddlmZmZddlZdd l m Z dd l m Z m Z mZdd lmZmZydd lmZWn)ek rßed dddƒ‚nXedƒ\ZZejjZdefd„ƒYZdefd„ƒYZdefd„ƒYZdefd„ƒYZdefd„ƒYZdefd„ƒYZdefd„ƒYZdS(tLocktRLockt SemaphoretBoundedSemaphoret ConditiontEventiÿÿÿÿN(ttimetsleep(tcurrent_process(tFinalizetregister_after_forktdebug(tassert_spawningtPopen(tSemLocks*This platform lacks a functioning sem_opens( implementation, therefore, the requireds+ synchronization primitives needed will nots function, see issue 3770.iRcBs>eZd„Zd„Zd„Zd„Zd„Zd„ZRS(cCsctj|||ƒ}|_td|jƒ|jƒtjdkr_d„}t||ƒndS(Nscreated semlock with handle %stwin32cSs|jjƒdS(N(t_semlockt _after_fork(tobj((s1/usr/lib/python2.7/multiprocessing/synchronize.pyRPs( t_multiprocessingRRR thandlet _make_methodstsystplatformR (tselftkindtvaluetmaxvaluetslR((s1/usr/lib/python2.7/multiprocessing/synchronize.pyt__init__Js   cCs"|jj|_|jj|_dS(N(Rtacquiretrelease(R((s1/usr/lib/python2.7/multiprocessing/synchronize.pyRTscCs |jjƒS(N(Rt __enter__(R((s1/usr/lib/python2.7/multiprocessing/synchronize.pyR XscGs|jj|ŒS(N(Rt__exit__(Rtargs((s1/usr/lib/python2.7/multiprocessing/synchronize.pyR![scCs2t|ƒ|j}tj|jƒ|j|jfS(N(R RR tduplicate_for_childRRR(RR((s1/usr/lib/python2.7/multiprocessing/synchronize.pyt __getstate__^s  cCs5tjj|Œ|_td|dƒ|jƒdS(Ns recreated blocker with handle %ri(RRt_rebuildRR R(Rtstate((s1/usr/lib/python2.7/multiprocessing/synchronize.pyt __setstate__cs(t__name__t __module__RRR R!R$R'(((s1/usr/lib/python2.7/multiprocessing/synchronize.pyRHs     cBs&eZdd„Zd„Zd„ZRS(icCstj|t|tƒdS(N(RRt SEMAPHOREt SEM_VALUE_MAX(RR((s1/usr/lib/python2.7/multiprocessing/synchronize.pyRnscCs |jjƒS(N(Rt _get_value(R((s1/usr/lib/python2.7/multiprocessing/synchronize.pyt get_valueqscCs5y|jjƒ}Wntk r,d}nXd|S(Ntunknowns(RR,t Exception(RR((s1/usr/lib/python2.7/multiprocessing/synchronize.pyt__repr__ts   (R(R)RR-R0(((s1/usr/lib/python2.7/multiprocessing/synchronize.pyRls  cBseZdd„Zd„ZRS(icCstj|t||ƒdS(N(RRR*(RR((s1/usr/lib/python2.7/multiprocessing/synchronize.pyRscCsAy|jjƒ}Wntk r,d}nXd||jjfS(NR.s)(RR,R/R(RR((s1/usr/lib/python2.7/multiprocessing/synchronize.pyR0„s   (R(R)RR0(((s1/usr/lib/python2.7/multiprocessing/synchronize.pyRs cBseZd„Zd„ZRS(cCstj|tddƒdS(Ni(RRR*(R((s1/usr/lib/python2.7/multiprocessing/synchronize.pyR’scCsµy“|jjƒrPtƒj}tjƒjdkr’|dtjƒj7}q’nB|jjƒdkrnd}n$|jjƒdkrŒd}nd}Wntk r¬d}nXd |S( Nt MainThreadt|itNoneitSomeOtherThreadtSomeOtherProcessR.s( Rt_is_mineRtnamet threadingtcurrent_threadR,t_countR/(RR7((s1/usr/lib/python2.7/multiprocessing/synchronize.pyR0•s      (R(R)RR0(((s1/usr/lib/python2.7/multiprocessing/synchronize.pyRs cBseZd„Zd„ZRS(cCstj|tddƒdS(Ni(RRtRECURSIVE_MUTEX(R((s1/usr/lib/python2.7/multiprocessing/synchronize.pyR«scCsây´|jjƒr_tƒj}tjƒjdkrM|dtjƒj7}n|jjƒ}nT|jjƒdkrƒd \}}n0|jjƒdkr§d \}}n d \}}Wntk rÓd\}}nXd ||fS(NR1R2iR3iR4tnonzeroR5R.s(sNonei(sSomeOtherThreadR<(sSomeOtherProcessR<(sunknownsunknown( RR6RR7R8R9R:R,R/(RR7tcount((s1/usr/lib/python2.7/multiprocessing/synchronize.pyR0®s  (R(R)RR0(((s1/usr/lib/python2.7/multiprocessing/synchronize.pyR©s cBsheZd d„Zd„Zd„Zd„Zd„Zd„Zd„Z d d„Z d„Z d „Z RS( cCsM|p tƒ|_tdƒ|_tdƒ|_tdƒ|_|jƒdS(Ni(Rt_lockRt_sleeping_countt _woken_countt_wait_semaphoreR(Rtlock((s1/usr/lib/python2.7/multiprocessing/synchronize.pyRÅs cCs&t|ƒ|j|j|j|jfS(N(R R>R?R@RA(R((s1/usr/lib/python2.7/multiprocessing/synchronize.pyR$Ìs  cCs,|\|_|_|_|_|jƒdS(N(R>R?R@RAR(RR&((s1/usr/lib/python2.7/multiprocessing/synchronize.pyR'ÑscCs |jjƒS(N(R>R (R((s1/usr/lib/python2.7/multiprocessing/synchronize.pyR ÖscGs|jj|ŒS(N(R>R!(RR"((s1/usr/lib/python2.7/multiprocessing/synchronize.pyR!ÙscCs"|jj|_|jj|_dS(N(R>RR(R((s1/usr/lib/python2.7/multiprocessing/synchronize.pyRÜscCsQy&|jjjƒ|jjjƒ}Wntk r?d}nXd|j|fS(Ntunkowns(R?RR,R@R/R>(Rt num_waiters((s1/usr/lib/python2.7/multiprocessing/synchronize.pyR0às   cCs“|jjƒ|jjjƒ}x!t|ƒD]}|jjƒq,Wz|jjt|ƒWd|j jƒx!t|ƒD]}|jjƒqwWXdS(N( R?RR>RR:txrangeRARtTrueR@(RttimeoutR=ti((s1/usr/lib/python2.7/multiprocessing/synchronize.pytwaitès  cCsnx(|jjtƒr*|jjtƒ}qW|jjtƒrj|jjƒ|jjƒ|jjtƒndS(N(R@RtFalseR?RAR(Rtres((s1/usr/lib/python2.7/multiprocessing/synchronize.pytnotifyÿs  cCs«x(|jjtƒr*|jjtƒ}qWd}x-|jjtƒr`|jjƒ|d7}q4W|r§x!t|ƒD]}|jjƒqtWx|jjtƒr£qŽWndS(Nii(R@RRJR?RARRE(RRKtsleepersRH((s1/usr/lib/python2.7/multiprocessing/synchronize.pyt notify_alls N( R(R)R3RR$R'R R!RR0RIRLRN(((s1/usr/lib/python2.7/multiprocessing/synchronize.pyRÃs         cBs8eZd„Zd„Zd„Zd„Zdd„ZRS(cCs%ttƒƒ|_tdƒ|_dS(Ni(RRt_condRt_flag(R((s1/usr/lib/python2.7/multiprocessing/synchronize.pyR-scCsM|jjƒz+|jjtƒr3|jjƒtStSWd|jjƒXdS(N(RORRPRJRRF(R((s1/usr/lib/python2.7/multiprocessing/synchronize.pytis_set1s  cCsP|jjƒz.|jjtƒ|jjƒ|jjƒWd|jjƒXdS(N(RORRPRJRRN(R((s1/usr/lib/python2.7/multiprocessing/synchronize.pytset;s   cCs6|jjƒz|jjtƒWd|jjƒXdS(N(RORRPRJR(R((s1/usr/lib/python2.7/multiprocessing/synchronize.pytclearDs cCs|jjƒz]|jjtƒr2|jjƒn|jj|ƒ|jjtƒre|jjƒtStSWd|jjƒXdS(N(RORRPRJRRIRF(RRG((s1/usr/lib/python2.7/multiprocessing/synchronize.pyRIKs  N(R(R)RRQRRRSR3RI(((s1/usr/lib/python2.7/multiprocessing/synchronize.pyR+s   (t__all__R8tosRRt_timeRt_sleepRtmultiprocessing.processRtmultiprocessing.utilR R R tmultiprocessing.forkingR R Rt ImportErrortrangeR;R*R+tobjectRRRRRR(((s1/usr/lib/python2.7/multiprocessing/synchronize.pyt$s.       $h