Plan 9 from Bell Labs’s /usr/web/sources/contrib/stallion/root/sys/lib/python2.7/multiprocessing/synchronize.pyc

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


�`^c@s�ddddddgZddlZddlZddlZddlmZmZddlZdd	l	m
Z
dd
lmZm
Z
mZddlmZmZydd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/sys/lib/python2.7/multiprocessing/synchronize.pyRPs(	t_multiprocessingRRRthandlet
_make_methodstsystplatformR
(tselftkindtvaluetmaxvaluetslR((s1/sys/lib/python2.7/multiprocessing/synchronize.pyt__init__Js
	cCs"|jj|_|jj|_dS(N(Rtacquiretrelease(R((s1/sys/lib/python2.7/multiprocessing/synchronize.pyRTscCs
|jj�S(N(Rt	__enter__(R((s1/sys/lib/python2.7/multiprocessing/synchronize.pyR XscGs|jj|�S(N(Rt__exit__(Rtargs((s1/sys/lib/python2.7/multiprocessing/synchronize.pyR![scCs2t|�|j}tj|j�|j|jfS(N(RRR
tduplicate_for_childRRR(RR((s1/sys/lib/python2.7/multiprocessing/synchronize.pyt__getstate__^s
	cCs5tjj|�|_td|d�|j�dS(Ns recreated blocker with handle %ri(RRt_rebuildRRR(Rtstate((s1/sys/lib/python2.7/multiprocessing/synchronize.pyt__setstate__cs(t__name__t
__module__RRR R!R$R'(((s1/sys/lib/python2.7/multiprocessing/synchronize.pyRHs	
				cBs&eZdd�Zd�Zd�ZRS(icCstj|t|t�dS(N(RRt	SEMAPHOREt
SEM_VALUE_MAX(RR((s1/sys/lib/python2.7/multiprocessing/synchronize.pyRnscCs
|jj�S(N(Rt
_get_value(R((s1/sys/lib/python2.7/multiprocessing/synchronize.pyt	get_valueqscCs5y|jj�}Wntk
r,d}nXd|S(Ntunknowns<Semaphore(value=%s)>(RR,t	Exception(RR((s1/sys/lib/python2.7/multiprocessing/synchronize.pyt__repr__ts


(R(R)RR-R0(((s1/sys/lib/python2.7/multiprocessing/synchronize.pyRls	cBseZdd�Zd�ZRS(icCstj|t||�dS(N(RRR*(RR((s1/sys/lib/python2.7/multiprocessing/synchronize.pyR�scCsAy|jj�}Wntk
r,d}nXd||jjfS(NR.s)<BoundedSemaphore(value=%s, maxvalue=%s)>(RR,R/R(RR((s1/sys/lib/python2.7/multiprocessing/synchronize.pyR0�s

(R(R)RR0(((s1/sys/lib/python2.7/multiprocessing/synchronize.pyRscBseZd�Zd�ZRS(cCstj|tdd�dS(Ni(RRR*(R((s1/sys/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<Lock(owner=%s)>(	Rt_is_mineRtnamet	threadingtcurrent_threadR,t_countR/(RR7((s1/sys/lib/python2.7/multiprocessing/synchronize.pyR0�s		


(R(R)RR0(((s1/sys/lib/python2.7/multiprocessing/synchronize.pyR�s	cBseZd�Zd�ZRS(cCstj|tdd�dS(Ni(RRtRECURSIVE_MUTEX(R((s1/sys/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<RLock(%s, %s)>(sNonei(sSomeOtherThreadR<(sSomeOtherProcessR<(sunknownsunknown(	RR6RR7R8R9R:R,R/(RR7tcount((s1/sys/lib/python2.7/multiprocessing/synchronize.pyR0�s
(R(R)RR0(((s1/sys/lib/python2.7/multiprocessing/synchronize.pyR�s	cBsheZd
d�Zd�Zd�Zd�Zd�Zd�Zd�Z	d
d�Z
d�Zd	�ZRS(cCsM|pt�|_td�|_td�|_td�|_|j�dS(Ni(Rt_lockRt_sleeping_countt_woken_countt_wait_semaphoreR(Rtlock((s1/sys/lib/python2.7/multiprocessing/synchronize.pyR�s
cCs&t|�|j|j|j|jfS(N(RR>R?R@RA(R((s1/sys/lib/python2.7/multiprocessing/synchronize.pyR$�s
cCs,|\|_|_|_|_|j�dS(N(R>R?R@RAR(RR&((s1/sys/lib/python2.7/multiprocessing/synchronize.pyR'�scCs
|jj�S(N(R>R (R((s1/sys/lib/python2.7/multiprocessing/synchronize.pyR �scGs|jj|�S(N(R>R!(RR"((s1/sys/lib/python2.7/multiprocessing/synchronize.pyR!�scCs"|jj|_|jj|_dS(N(R>RR(R((s1/sys/lib/python2.7/multiprocessing/synchronize.pyR�scCsQy&|jjj�|jjj�}Wntk
r?d}nXd|j|fS(NR.s<Condition(%s, %s)>(R?RR,R@R/R>(Rtnum_waiters((s1/sys/lib/python2.7/multiprocessing/synchronize.pyR0�s

cCs�|jjj�std��|jj�|jjj�}x!t|�D]}|jj�qJWz|jj	t
|�Wd|jj�x!t|�D]}|jj	�q�WXdS(Ns,must acquire() condition before using wait()(R>RR6tAssertionErrorR?RR:txrangeRARtTrueR@(RttimeoutR=ti((s1/sys/lib/python2.7/multiprocessing/synchronize.pytwait�s	

cCs�|jjj�std��|jjt�s7t�x4|jjt�rm|jjt�}|s:t�q:W|jjt�r�|jj	�|jj�|jjt�ndS(Nslock is not owned(
R>RR6RDRARtFalseR@R?R(Rtres((s1/sys/lib/python2.7/multiprocessing/synchronize.pytnotify�s

cCs�|jjj�std��|jjt�s7t�x4|jjt�rm|jjt�}|s:t�q:Wd}x-|jjt�r�|jj	�|d7}qwW|r�!t
|�D]}|jj�q�Wx|jjt�r��WndS(Nslock is not ownedii(R>RR6RDRARRJR@R?RRE(RRKtsleepersRH((s1/sys/lib/python2.7/multiprocessing/synchronize.pyt
notify_alls
N(
R(R)R3RR$R'R R!RR0RIRLRN(((s1/sys/lib/python2.7/multiprocessing/synchronize.pyR�s							cBs8eZd�Zd�Zd�Zd�Zdd�ZRS(cCs%tt��|_td�|_dS(Ni(RRt_condRt_flag(R((s1/sys/lib/python2.7/multiprocessing/synchronize.pyR-scCsM|jj�z+|jjt�r3|jj�tStSWd|jj�XdS(N(RORRPRJRRF(R((s1/sys/lib/python2.7/multiprocessing/synchronize.pytis_set1s

cCsP|jj�z.|jjt�|jj�|jj�Wd|jj�XdS(N(RORRPRJRRN(R((s1/sys/lib/python2.7/multiprocessing/synchronize.pytset;s

cCs6|jj�z|jjt�Wd|jj�XdS(N(RORRPRJR(R((s1/sys/lib/python2.7/multiprocessing/synchronize.pytclearDs
cCs|jj�z]|jjt�r2|jj�n|jj|�|jjt�re|jj�tStSWd|jj�XdS(N(RORRPRJRRIRF(RRG((s1/sys/lib/python2.7/multiprocessing/synchronize.pyRIKs

N(R(R)RRQRRRSR3RI(((s1/sys/lib/python2.7/multiprocessing/synchronize.pyR+s
		
			(t__all__R8tosRRt_timeRt_sleepRtmultiprocessing.processRtmultiprocessing.utilR	R
Rtmultiprocessing.forkingRR
RtImportErrortrangeR;R*R+tobjectRRRRRR(((s1/sys/lib/python2.7/multiprocessing/synchronize.pyt<module>$s.
$h

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to [email protected].