Your IP : 18.221.248.140


Current Path : /lib64/python3.8/multiprocessing/__pycache__/
Upload File :
Current File : //lib64/python3.8/multiprocessing/__pycache__/queues.cpython-38.pyc

U

e5d�-�@s�dddgZddlZddlZddlZddlZddlZddlZddlZddlm	Z	m
Z
ddlZddlm
Z
ddlmZejjZdd	lmZmZmZmZmZGd
d�de�Ze�ZGdd�de�ZGdd�de�ZdS)
�Queue�SimpleQueue�
JoinableQueue�N)�Empty�Full�)�
connection)�context)�debug�info�Finalize�register_after_fork�
is_exitingc@s�eZdZd*dd�Zdd�Zdd�Zdd	�Zd+dd
�Zd,dd�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zd d!�Zed"d#��Zed$d%��Zed&d'��Zed(d)��ZdS)-rrcCs�|dkrddlm}||_tjdd�\|_|_|��|_t	�
�|_tj
dkrTd|_n
|��|_|�|�|_d|_|��tj
dkr�t|tj�dS)Nrr)�
SEM_VALUE_MAXF�Zduplex�win32)Zsynchronizer�_maxsizer�Pipe�_reader�_writer�Lock�_rlock�os�getpid�_opid�sys�platform�_wlockZBoundedSemaphore�_sem�
_ignore_epipe�_after_forkr
r��self�maxsize�ctx�r%�./usr/lib64/python3.8/multiprocessing/queues.py�__init__$s




zQueue.__init__cCs.t�|�|j|j|j|j|j|j|j|j	fS�N)
r	�assert_spawningrrrrrrrr�r"r%r%r&�__getstate__9s
�zQueue.__getstate__c	Cs0|\|_|_|_|_|_|_|_|_|��dSr()	rrrrrrrrr �r"�stater%r%r&�__setstate__>s�zQueue.__setstate__cCsbtd�t�t���|_t��|_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�_pollr*r%r%r&r Cs


zQueue._after_forkTNc	Csf|jrtd|�d���|j�||�s(t�|j�.|jdkrB|��|j�	|�|j�
�W5QRXdS�NzQueue z
 is closed)r8�
ValueErrorr�acquirerr1r5�
_start_threadr4�append�notify�r"�obj�block�timeoutr%r%r&�putPs
z	Queue.putc	Cs�|jrtd|�d���|rH|dkrH|j�|��}W5QRX|j��nr|rXt��|}|j�||�sjt	�zB|r�|t��}|�
|�s�t	�n|�
�s�t	�|��}|j��W5|j��Xt�|�Sr@)
r8rArr=r�release�time�	monotonicrBrr?�_ForkingPickler�loads)r"rHrI�resZdeadliner%r%r&�get\s*
z	Queue.getcCs|j|jj��Sr()rr�_semlockZ
_get_valuer*r%r%r&�qsizevszQueue.qsizecCs
|��Sr(�r?r*r%r%r&�emptyzszQueue.emptycCs|jj��Sr()rrR�_is_zeror*r%r%r&�full}sz
Queue.fullcCs
|�d�S�NF)rQr*r%r%r&�
get_nowait�szQueue.get_nowaitcCs|�|d�SrX)rJ�r"rGr%r%r&�
put_nowait�szQueue.put_nowaitcCs2d|_z|j��W5|j}|r,d|_|�XdS)NT)r8r9r�close)r"r\r%r%r&r\�szQueue.closecCs.td�|jstd�|���|jr*|��dS)NzQueue.join_thread()zQueue {0!r} not closed)r
r8�AssertionError�formatr6r*r%r%r&�join_thread�szQueue.join_threadcCs6td�d|_z|j��Wntk
r0YnXdS)NzQueue.cancel_join_thread()T)r
r7r6Zcancel�AttributeErrorr*r%r%r&�cancel_join_thread�szQueue.cancel_join_threadc
Cs�td�|j��tjtj|j|j|j|j	|j
j|j|j
|jfdd�|_d|j_td�|j��td�|js�t|jtjt�|j�gdd�|_t|tj|j|jgd	d�|_dS)
NzQueue._start_thread()ZQueueFeederThread)�target�args�nameTzdoing self._thread.start()z... done self._thread.start()���)Zexitpriority�
)r
r4�clearr/ZThreadr�_feedr1r;rrr\r�_on_queue_feeder_errorrr5Zdaemon�startr7r�_finalize_join�weakref�refr6�_finalize_closer9r*r%r%r&rC�s<
��
�
�zQueue._start_threadcCs4td�|�}|dk	r(|��td�ntd�dS)Nzjoining queue threadz... queue thread joinedz... queue thread already dead)r
�join)Ztwr�threadr%r%r&rk�s
zQueue._finalize_joinc	Cs.td�|�|�t�|��W5QRXdS)Nztelling queue thread to quit)r
rD�	_sentinelrE)�buffer�notemptyr%r%r&rn�s
zQueue._finalize_closec
CsXtd�|j}|j}	|j}
|j}t}tjdkr<|j}
|j}nd}
z�|�z|sT|
�W5|	�Xzb|�}||kr�td�|�WWdSt�	|�}|
dkr�||�qb|
�z||�W5|�XqbWnt
k
r�YnXWq@tk
�rP}zV|�rt|dd�t
jk�rWY�6dSt��r.td|�WY�dS|��|||�W5d}~XYq@Xq@dS)Nz$starting thread to feed data to piperz%feeder thread got sentinel -- exiting�errnorzerror in queue thread: %s)r
rBrK�wait�popleftrqrrrN�dumps�
IndexError�	Exception�getattrrtZEPIPErr)rrrsr:Z	writelockr\Zignore_epipe�onerrorZ	queue_semZnacquireZnreleaseZnwaitZbpopleft�sentinelZwacquireZwreleaserG�er%r%r&rh�sN







zQueue._feedcCsddl}|��dS)z�
        Private API hook called when feeding data in the background thread
        raises an exception.  For overriding by concurrent.futures.
        rN)�	traceback�	print_exc)r}rGr~r%r%r&ri
szQueue._on_queue_feeder_error)r)TN)TN)�__name__�
__module__�__qualname__r'r+r.r rJrQrSrUrWrYr[r\r_rarC�staticmethodrkrnrhrir%r%r%r&r"s.



 
	

=c@s@eZdZddd�Zdd�Zdd�Zdd
d�Zdd
�Zdd�Zd	S)rrcCs*tj|||d�|�d�|_|��|_dS)N)r$r)rr'Z	Semaphore�_unfinished_tasksr0�_condr!r%r%r&r'#szJoinableQueue.__init__cCst�|�|j|jfSr()rr+r�r�r*r%r%r&r+(szJoinableQueue.__getstate__cCs,t�||dd��|dd�\|_|_dS)N���)rr.r�r�r,r%r%r&r.+szJoinableQueue.__setstate__TNc
Cs�|jrtd|�d���|j�||�s(t�|j�J|j�8|jdkrJ|��|j	�
|�|j��|j�
�W5QRXW5QRXdSr@)r8rArrBrr1r�r5rCr4rDr�rKrErFr%r%r&rJ/s

zJoinableQueue.putc	Cs@|j�0|j�d�std��|jj��r2|j��W5QRXdS)NFz!task_done() called too many times)r�r�rBrArRrVZ
notify_allr*r%r%r&�	task_done<s
zJoinableQueue.task_donec	Cs,|j�|jj��s|j��W5QRXdSr()r�r�rRrVrur*r%r%r&roCszJoinableQueue.join)r)TN)	r�r�r�r'r+r.rJr�ror%r%r%r&r!s


c@s<eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
S)rcCsHtjdd�\|_|_|��|_|jj|_tj	dkr:d|_
n
|��|_
dS)NFrr)rrrrrrr>r?rrr)r"r$r%r%r&r'Ns


zSimpleQueue.__init__cCs
|��Sr(rTr*r%r%r&rUWszSimpleQueue.emptycCst�|�|j|j|j|jfSr()r	r)rrrrr*r%r%r&r+Zs
zSimpleQueue.__getstate__cCs"|\|_|_|_|_|jj|_dSr()rrrrr>r?r,r%r%r&r.^szSimpleQueue.__setstate__c	Cs&|j�|j��}W5QRXt�|�Sr()rrr<rNrO)r"rPr%r%r&rQbszSimpleQueue.getc	CsDt�|�}|jdkr"|j�|�n|j�|j�|�W5QRXdSr()rNrwrrr:rZr%r%r&rJhs


zSimpleQueue.putN)	r�r�r�r'rUr+r.rQrJr%r%r%r&rLs	)�__all__rrr/r2rLrlrtZqueuerrZ_multiprocessing�rr	Z	reductionZForkingPicklerrN�utilr
rrr
r�objectrrqrrr%r%r%r&�<module>
s$
v
+

?>