Your IP : 18.225.98.39


Current Path : /opt/alt/python35/lib64/python3.5/multiprocessing/__pycache__/
Upload File :
Current 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
lmZGdd�de�Ze�ZGdd�de�ZGd
d�de�ZdS)�Queue�SimpleQueue�
JoinableQueue�N)�Empty�Full�)�
connection)�context)�debug�info�Finalize�register_after_fork�
is_exiting)�ForkingPicklerc@s	eZdZddd�Zdd�Zdd�Zdd	�Zd
ddd
�Zd
ddd�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zd d!�Zed"d#��Zed$d%��Zed&d'��ZdS)(rrcCs�|dkrddlm}||_tjdd�\|_|_|j�|_t	j
�|_tj
dkr|d|_n|j�|_|j|�|_d|_|j�tj
dkr�t|tj�dS)Nrr)�
SEM_VALUE_MAX�duplexF�win32)�synchronizer�_maxsizer�Pipe�_reader�_writer�Lock�_rlock�os�getpid�_opid�sys�platform�_wlock�BoundedSemaphore�_sem�
_ignore_epipe�_after_forkr
r)�self�maxsize�ctx�r'�+/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|\|_|_|_|_|_|_|_|_|j�dS)N)	r"rrrrrr!rr#)r$�stater'r'r(�__setstate__>s6zQueue.__setstate__cCs�td�tjtj��|_tj�|_d|_d|_	d|_
d|_d|_|j
j|_|jj|_|jj|_dS)NzQueue._after_fork()F)r
�	threading�	Conditionr�	_notempty�collections�deque�_buffer�_thread�_jointhread�_joincancelled�_closed�_closer�
send_bytes�_send_bytesr�
recv_bytes�_recv_bytes�poll�_poll)r$r'r'r(r#Cs
					zQueue._after_forkTNc	Csf|jj||�st�|j�;|jdkr>|j�|jj|�|jj�WdQRXdS)N)	r!�acquirerr0r4�
_start_threadr3�append�notify)r$�obj�block�timeoutr'r'r(�putPs

z	Queue.putc
Cs�|r?|dkr?|j�|j�}WdQRX|jj�n�|rUtj�|}|jj||�spt�zj|r�|tj�}|dks�|j|�r�t�n|j�s�t�|j�}|jj�Wd|jj�Xtj	|�S)Nr)
rr<r!�release�timer?rr>r�loads)r$rDrE�res�deadliner'r'r(�get[s&
	z	Queue.getcCs|j|jjj�S)N)rr!�_semlock�
_get_value)r$r'r'r(�qsizesszQueue.qsizecCs|j�S)N)r>)r$r'r'r(�emptywszQueue.emptycCs|jjj�S)N)r!rM�_is_zero)r$r'r'r(�fullzsz
Queue.fullcCs
|jd�S)NF)rL)r$r'r'r(�
get_nowait}szQueue.get_nowaitcCs|j|d�S)NF)rF)r$rCr'r'r(�
put_nowait�szQueue.put_nowaitcCsAd|_z|jj�Wd|j}|r<d|_|�XdS)NT)r7r�closer8)r$rUr'r'r(rU�s			zQueue.closecCs!td�|jr|j�dS)NzQueue.join_thread())r
r5)r$r'r'r(�join_thread�s
	zQueue.join_threadcCs=td�d|_y|jj�Wntk
r8YnXdS)NzQueue.cancel_join_thread()T)r
r6r5�cancel�AttributeError)r$r'r'r(�cancel_join_thread�s
	
zQueue.cancel_join_threadc
Cs�td�|jj�tjdtjd|j|j|j|j	|j
j|jfdd�|_
d|j
_td�|j
j�td�|js�t|j
tjtj|j
�gd	d�|_t|tj|j|jgd	d�|_dS)
NzQueue._start_thread()�target�args�nameZQueueFeederThreadTzdoing self._thread.start()z... done self._thread.start()�exitpriority��
���)r
r3�clearr.�Threadr�_feedr0r:rrrUr"r4�daemon�startr6r�_finalize_join�weakref�refr5�_finalize_closer8)r$r'r'r(r@�s(

		


		zQueue._start_threadcCsDtd�|�}|dk	r6|j�td�n
td�dS)Nzjoining queue threadz... queue thread joinedz... queue thread already dead)r
�join)Ztwr�threadr'r'r(rf�s
	

zQueue._finalize_joinc	Cs3td�|�|jt�|j�WdQRXdS)Nztelling queue thread to quit)r
rA�	_sentinelrB)�buffer�notemptyr'r'r(ri�s

zQueue._finalize_closecCs�td�|j}|j}|j}|j}	t}
tjdkrX|j}|j}nd}x:y�|�z|s{|�Wd|�Xy}xv|	�}
|
|
kr�td�|�dStj	|
�}
|dkr�||
�q�|�z||
�Wd|�Xq�WWnt
k
rYnXWqatk
r�}zZ|rTt|dd�t
jkrTdSt�rntd|�dSddl}|j�WYdd}~XqaXqaWdS)Nz$starting thread to feed data to piperz%feeder thread got sentinel -- exiting�errnorzerror in queue thread: %s)r
r?rG�wait�popleftrlrrr�dumps�
IndexError�	Exception�getattrroZEPIPErr�	traceback�	print_exc)rmrnr9Z	writelockrUZignore_epipeZnacquireZnreleaseZnwaitZbpopleft�sentinelZwacquireZwreleaserC�ervr'r'r(rc�sR
						


	!	
zQueue._feed)�__name__�
__module__�__qualname__r)r+r-r#rFrLrOrPrRrSrTrUrVrYr@�staticmethodrfrircr'r'r'r(r"s$


c@saeZdZddd�Zdd�Zdd�Zdd	d
d�Zdd
�Zdd�Zd	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+r�r)r$r'r'r(r+szJoinableQueue.__getstate__cCs:tj||dd��|dd�\|_|_dS)N����r�)rr-r�r)r$r,r'r'r(r-szJoinableQueue.__setstate__TNcCs�|jj||�st�|j�Y|j�H|jdkrH|j�|jj|�|j	j
�|jj�WdQRXWdQRXdS)N)r!r?rr0r�r4r@r3rArrGrB)r$rCrDrEr'r'r(rFs

zJoinableQueue.putc	CsR|j�B|jjd�s(td��|jjj�rG|jj�WdQRXdS)NFz!task_done() called too many times)r�rr?�
ValueErrorrMrQ�
notify_all)r$r'r'r(�	task_done's

zJoinableQueue.task_donec	Cs4|j�$|jjj�s)|jj�WdQRXdS)N)r�rrMrQrp)r$r'r'r(rj.s
zJoinableQueue.join)	rzr{r|r)r+r-rFr�rjr'r'r'r(r
sc@sXeZdZdd�Zdd�Zdd�Zdd�Zd	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.r1rHrgro�queuerr�_multiprocessing�rr	�utilr
rrr
r�	reductionr�objectrrlrrr'r'r'r(�<module>
s"(�	
*

?>