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

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


��Qc@s8dddgZddlZddlZddlZddlZddlZddlZddlZddlm	Z	m
Z
ddlZddlm
Z
ddlmZmZmZmZddlmZmZmZmZdd	lmZdefd
��YZe�Zdefd��YZdefd��YZdS(
tQueuetSimpleQueuet
JoinableQueuei�N(tEmptytFull(tPipe(tLocktBoundedSemaphoret	Semaphoret	Condition(tdebugtinfotFinalizetregister_after_fork(tassert_spawningcBs�eZdd�Zd�Zd�Zd�Zedd�Zedd�Z	d�Z
d�Zd	�Zd
�Z
d�Zd�Zd
�Zd�Zd�Zed��Zed��Zed��ZRS(icCs�|dkrtjj}n||_tdt�\|_|_t�|_	t
j�|_t
jdkrud|_nt�|_t|�|_|j�t
jdkr�t|tj�ndS(Nitduplextwin32(t_multiprocessingtSemLockt
SEM_VALUE_MAXt_maxsizeRtFalset_readert_writerRt_rlocktostgetpidt_opidtsystplatformtNonet_wlockRt_semt_after_forkR
R(tselftmaxsize((s,/sys/lib/python2.7/multiprocessing/queues.pyt__init__:s	
cCs8t|�|j|j|j|j|j|j|jfS(N(RRRRRRR R(R"((s,/sys/lib/python2.7/multiprocessing/queues.pyt__getstate__Ls
cCs>|\|_|_|_|_|_|_|_|j�dS(N(RRRRRR RR!(R"tstate((s,/sys/lib/python2.7/multiprocessing/queues.pyt__setstate__Qs0cCs�td�tjtj��|_tj�|_d|_	d|_
t|_t|_
d|_|jj|_|jj|_|jj|_dS(NsQueue._after_fork()(R
t	threadingR	Rt	_notemptytcollectionstdequet_bufferRt_threadt_jointhreadRt_joincancelledt_closedt_closeRtsendt_sendRtrecvt_recvtpollt_poll(R"((s,/sys/lib/python2.7/multiprocessing/queues.pyR!Vs
					cCs�|jst�|jj||�s.t�n|jj�z=|jdkrZ|j�n|j	j
|�|jj�Wd|jj�XdS(N(
R0tAssertionErrorR tacquireRR)R-Rt
_start_threadR,tappendtnotifytrelease(R"tobjtblockttimeout((s,/sys/lib/python2.7/multiprocessing/queues.pytputcs	

cCs|rT|dkrT|jj�z!|j�}|jj�|SWd|jj�Xn�|rmtj�|}n|jj||�s�t�nzt|r�|tj�}|dks�|j|�r��q�|j�s��n|j�}|jj�|SWd|jj�XdS(Ni(	RRR9R5R R=ttimeRR7(R"R?R@trestdeadline((s,/sys/lib/python2.7/multiprocessing/queues.pytgetqs,

		
cCs|j|jjj�S(N(RR t_semlockt
_get_value(R"((s,/sys/lib/python2.7/multiprocessing/queues.pytqsize�scCs|j�S(N(R7(R"((s,/sys/lib/python2.7/multiprocessing/queues.pytempty�scCs|jjj�S(N(R RFt_is_zero(R"((s,/sys/lib/python2.7/multiprocessing/queues.pytfull�scCs
|jt�S(N(RER(R"((s,/sys/lib/python2.7/multiprocessing/queues.pyt
get_nowait�scCs|j|t�S(N(RAR(R"R>((s,/sys/lib/python2.7/multiprocessing/queues.pyt
put_nowait�scCs0t|_|jj�|jr,|j�ndS(N(tTrueR0RtcloseR1(R"((s,/sys/lib/python2.7/multiprocessing/queues.pyRO�s	
	cCs3td�|jst�|jr/|j�ndS(NsQueue.join_thread()(R
R0R8R.(R"((s,/sys/lib/python2.7/multiprocessing/queues.pytjoin_thread�s
	cCs<td�t|_y|jj�Wntk
r7nXdS(NsQueue.cancel_join_thread()(R
RNR/R.tcanceltAttributeError(R"((s,/sys/lib/python2.7/multiprocessing/queues.pytcancel_join_thread�s
	
c	Cs�td�|jj�tjdtjd|j|j|j|j	|j
jfdd�|_t
|j_td�|jj�td�|js�t|jtjtj|j�gdd	�|_nt|tj|j|jgdd
�|_dS(NsQueue._start_thread()ttargettargstnametQueueFeederThreadsdoing self._thread.start()s... done self._thread.start()texitpriorityi�i
(R
R,tclearR(tThreadRt_feedR)R3RRROR-RNtdaemontstartR/Rt_finalize_jointweakreftrefR.t_finalize_closeR1(R"((s,/sys/lib/python2.7/multiprocessing/queues.pyR:�s(

		


		cCsDtd�|�}|dk	r6|j�td�n
td�dS(Nsjoining queue threads... queue thread joineds... queue thread already dead(R
Rtjoin(ttwrtthread((s,/sys/lib/python2.7/multiprocessing/queues.pyR^�s
	

cCsAtd�|j�z|jt�|j�Wd|j�XdS(Nstelling queue thread to quit(R
R9R;t	_sentinelR<R=(tbuffertnotempty((s,/sys/lib/python2.7/multiprocessing/queues.pyRa�s


cCs�td�ddlm}|j}|j}|j}|j}	t}
tj	dkrh|j}|j}nd}y�x�|�z|s�|�nWd|�Xymxf|	�}
|
|
kr�td�|�dS|dkr�|
�q�|�z||
�Wd|�Xq�Wqttk
rqtXqtWnZtk
r{}y3|�rMt
d|�nddl}|j�Wq|tk
rwq|XnXdS(Ns$starting thread to feed data to pipei(t
is_exitingRs%feeder thread got sentinel -- exitingserror in queue thread: %si�(R
tutilRhR9R=twaittpopleftReRRRt
IndexErrort	ExceptionRt	tracebackt	print_exc(RfRgR2t	writelockRORhtnacquiretnreleasetnwaittbpoplefttsentineltwacquiretwreleaseR>teRn((s,/sys/lib/python2.7/multiprocessing/queues.pyR[�sR
						


	
N(t__name__t
__module__R$R%R'R!RNRRARERHRIRKRLRMRORPRSR:tstaticmethodR^RaR[(((s,/sys/lib/python2.7/multiprocessing/queues.pyR8s$			
									 

cBsGeZdd�Zd�Zd�Zedd�Zd�Zd�Z	RS(icCs/tj||�td�|_t�|_dS(Ni(RR$Rt_unfinished_tasksR	t_cond(R"R#((s,/sys/lib/python2.7/multiprocessing/queues.pyR$)scCstj|�|j|jfS(N(RR%R}R|(R"((s,/sys/lib/python2.7/multiprocessing/queues.pyR%.scCs.tj||d �|d\|_|_dS(Ni�(RR'R}R|(R"R&((s,/sys/lib/python2.7/multiprocessing/queues.pyR'1scCs�|jst�|jj||�s.t�n|jj�|jj�zJ|jdkrg|j	�n|j
j|�|jj
�|jj�Wd|jj
�|jj
�XdS(N(R0R8R R9RR)R}R-RR:R,R;R|R=R<(R"R>R?R@((s,/sys/lib/python2.7/multiprocessing/queues.pyRA5s	




cCsi|jj�zG|jjt�s1td��n|jjj�rS|jj�nWd|jj�XdS(Ns!task_done() called too many times(	R}R9R|Rt
ValueErrorRFRJt
notify_allR=(R"((s,/sys/lib/python2.7/multiprocessing/queues.pyt	task_doneFs
cCsH|jj�z&|jjj�s2|jj�nWd|jj�XdS(N(R}R9R|RFRJRjR=(R"((s,/sys/lib/python2.7/multiprocessing/queues.pyRbPs

N(
RyRzR$R%R'RNRRAR�Rb(((s,/sys/lib/python2.7/multiprocessing/queues.pyR's			
cBs5eZd�Zd�Zd�Zd�Zd�ZRS(cCs\tdt�\|_|_t�|_tjdkrBd|_	nt�|_	|j
�dS(NRR(RRRRRRRRRRt
_make_methods(R"((s,/sys/lib/python2.7/multiprocessing/queues.pyR$^scCs|jj�S(N(RR6(R"((s,/sys/lib/python2.7/multiprocessing/queues.pyRIgscCs&t|�|j|j|j|jfS(N(RRRRR(R"((s,/sys/lib/python2.7/multiprocessing/queues.pyR%js
cCs,|\|_|_|_|_|j�dS(N(RRRRR�(R"R&((s,/sys/lib/python2.7/multiprocessing/queues.pyR'nscs�|jj�|jj|jj�����fd�}||_|jdkrd|jj	|_
nC|jj	�|jj|jj�����fd�}||_
dS(Ncs!��z��SWd��XdS(N(((tracquireR4trrelease(s,/sys/lib/python2.7/multiprocessing/queues.pyREuscs$��z�|�SWd��XdS(N((R>(R2RvRw(s,/sys/lib/python2.7/multiprocessing/queues.pyRA�s(RR4RR9R=RERRRR2RA(R"RERA((R�R4R�R2RvRws,/sys/lib/python2.7/multiprocessing/queues.pyR�rs	(RyRzR$RIR%R'R�(((s,/sys/lib/python2.7/multiprocessing/queues.pyR\s
					(t__all__RRR(R*RBtatexitR_RRRRtmultiprocessingRtmultiprocessing.synchronizeRRRR	tmultiprocessing.utilR
RRR
tmultiprocessing.forkingRtobjectReRR(((s,/sys/lib/python2.7/multiprocessing/queues.pyt<module>#s"""�5

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].