Viewing File: /opt/alt/python35/lib64/python3.5/multiprocessing/__pycache__/queues.cpython-35.opt-2.pyc



])@s,dddgZddlZddlZddlZddlZddlZddlZddlZddlm	Z	m
Z
ddlZddlm
Z
ddlmZdd	lmZmZmZmZmZdd
lmZGdddeZeZGdddeZGd
ddeZdS)QueueSimpleQueue
JoinableQueueN)EmptyFull)
connection)context)debuginfoFinalizeregister_after_fork
is_exiting)ForkingPicklerc@s	eZdZdddZddZddZdd	Zd
ddd
Zd
dddZddZ	ddZ
ddZddZddZ
ddZddZddZd d!Zed"d#Zed$d%Zed&d'ZdS)(rrcCs|dkrddlm}||_tjdd\|_|_|j|_t	j
|_tj
dkr|d|_n|j|_|j||_d|_|jtj
dkrt|tjdS)Nrr)
SEM_VALUE_MAXduplexFwin32)synchronizer_maxsizerPipe_reader_writerLock_rlockosgetpid_opidsysplatform_wlockBoundedSemaphore_sem
_ignore_epipe_after_forkr
r)selfmaxsizectxr'+/opt/alt/python35/lib64/python3.5/queues.py__init__$s		
zQueue.__init__cCsAtj||j|j|j|j|j|j|j|j	fS)N)
r	assert_spawningr"rrrrrr!r)r$r'r'r(__getstate__9s
zQueue.__getstate__c	CsD|\|_|_|_|_|_|_|_|_|jdS)N)	r"rrrrrr!rr#)r$stater'r'r(__setstate__>s6zQueue.__setstate__cCstdtjtj|_tj|_d|_d|_	d|_
d|_d|_|j
j|_|jj|_|jj|_dS)NzQueue._after_fork()F)r
	threading	Conditionr	_notemptycollectionsdeque_buffer_thread_jointhread_joincancelled_closed_closer
send_bytes_send_bytesr
recv_bytes_recv_bytespoll_poll)r$r'r'r(r#Cs
					zQueue._after_forkTNc	Csf|jj||st|j;|jdkr>|j|jj||jjWdQRXdS)N)	r!acquirerr0r4
_start_threadr3appendnotify)r$objblocktimeoutr'r'r(putPs

z	Queue.putc
Cs|r?|dkr?|j|j}WdQRX|jjn|rUtj|}|jj||sptzj|r|tj}|dks|j|rtn|jst|j}|jjWd|jjXtj	|S)Nr)
rr<r!releasetimer?rr>rloads)r$rDrEresdeadliner'r'r(get[s&
	z	Queue.getcCs|j|jjjS)N)rr!_semlock
_get_value)r$r'r'r(qsizesszQueue.qsizecCs|jS)N)r>)r$r'r'r(emptywszQueue.emptycCs|jjjS)N)r!rM_is_zero)r$r'r'r(fullzsz
Queue.fullcCs
|jdS)NF)rL)r$r'r'r(
get_nowait}szQueue.get_nowaitcCs|j|dS)NF)rF)r$rCr'r'r(
put_nowaitszQueue.put_nowaitcCsAd|_z|jjWd|j}|r<d|_|XdS)NT)r7rcloser8)r$rUr'r'r(rUs			zQueue.closecCs!td|jr|jdS)NzQueue.join_thread())r
r5)r$r'r'r(join_threads
	zQueue.join_threadcCs=tdd|_y|jjWntk
r8YnXdS)NzQueue.cancel_join_thread()T)r
r6r5cancelAttributeError)r$r'r'r(cancel_join_threads
	
zQueue.cancel_join_threadc
Cstd|jjtjdtjd|j|j|j|j	|j
j|jfdd|_
d|j
_td|j
jtd|jst|j
tjtj|j
gd	d|_t|tj|j|jgd	d|_dS)
NzQueue._start_thread()targetargsnameZQueueFeederThreadTzdoing self._thread.start()z... done self._thread.start()exitpriority
)r
r3clearr.Threadr_feedr0r:rrrUr"r4daemonstartr6r_finalize_joinweakrefrefr5_finalize_closer8)r$r'r'r(r@s(

		


		zQueue._start_threadcCsDtd|}|dk	r6|jtdn
tddS)Nzjoining queue threadz... queue thread joinedz... queue thread already dead)r
join)Ztwrthreadr'r'r(rfs
	

zQueue._finalize_joinc	Cs3td||jt|jWdQRXdS)Nztelling queue thread to quit)r
rA	_sentinelrB)buffernotemptyr'r'r(ris

zQueue._finalize_closecCstd|j}|j}|j}|j}	t}
tjdkrX|j}|j}nd}x:y|z|s{|Wd|Xy}xv|	}
|
|
krtd|dStj	|
}
|dkr||
q|z||
Wd|XqWWnt
k
rYnXWqatk
r}zZ|rTt|ddt
jkrTdStrntd|dSddl}|jWYdd}~XqaXqaWdS)Nz$starting thread to feed data to piperz%feeder thread got sentinel -- exitingerrnorzerror in queue thread: %s)r
r?rGwaitpopleftrlrrrdumps
IndexError	ExceptiongetattrroZEPIPErr	traceback	print_exc)rmrnr9Z	writelockrUZignore_epipeZnacquireZnreleaseZnwaitZbpopleftsentinelZwacquireZwreleaserCervr'r'r(rcsR
						


	!	
zQueue._feed)__name__
__module____qualname__r)r+r-r#rFrLrOrPrRrSrTrUrVrYr@staticmethodrfrircr'r'r'r(r"s$


c@saeZdZdddZddZddZdd	d
dZdd
ZddZd	S)rrcCs;tj||d||jd|_|j|_dS)Nr&r)rr)	Semaphore_unfinished_tasksr/_cond)r$r%r&r'r'r(r)szJoinableQueue.__init__cCstj||j|jfS)N)rr+rr)r$r'r'r(r+szJoinableQueue.__getstate__cCs:tj||dd|dd\|_|_dS)Nr)rr-rr)r$r,r'r'r(r-szJoinableQueue.__setstate__TNcCs|jj||st|jY|jH|jdkrH|j|jj||j	j
|jjWdQRXWdQRXdS)N)r!r?rr0rr4r@r3rArrGrB)r$rCrDrEr'r'r(rFs

zJoinableQueue.putc	CsR|jB|jjds(td|jjjrG|jjWdQRXdS)NFz!task_done() called too many times)rrr?
ValueErrorrMrQ
notify_all)r$r'r'r(	task_done's

zJoinableQueue.task_donec	Cs4|j$|jjjs)|jjWdQRXdS)N)rrrMrQrp)r$r'r'r(rj.s
zJoinableQueue.join)	rzr{r|r)r+r-rFrrjr'r'r'r(r
sc@sXeZdZddZddZddZddZd	d
ZddZd
S)rcCsjtjdd\|_|_|j|_|jj|_tj	dkrWd|_
n|j|_
dS)NrFr)rrrrrrr=r>rrr)r$r&r'r'r(r)9szSimpleQueue.__init__cCs|jS)N)r>)r$r'r'r(rPBszSimpleQueue.emptycCs)tj||j|j|j|jfS)N)r	r*rrrr)r$r'r'r(r+Es
zSimpleQueue.__getstate__cCs1|\|_|_|_|_|jj|_dS)N)rrrrr=r>)r$r,r'r'r(r-IszSimpleQueue.__setstate__c	Cs-|j|jj}WdQRXtj|S)N)rrr;rrI)r$rJr'r'r(rLMs
zSimpleQueue.getc	CsVtj|}|jdkr1|jj|n!|j|jj|WdQRXdS)N)rrrrrr9)r$rCr'r'r(rFSs

zSimpleQueue.putN)	rzr{r|r)rPr+r-rLrFr'r'r'r(r7s	)__all__rrr.r1rHrgroqueuerr_multiprocessingrr	utilr
rrr
r	reductionrobjectrrlrrr'r'r'r(<module>
s"(	
*
Back to Directory File Manager