AlkantarClanX12

Your IP : 3.141.35.27


Current Path : /opt/alt/python37/lib64/python3.7/multiprocessing/__pycache__/
Upload File :
Current File : //opt/alt/python37/lib64/python3.7/multiprocessing/__pycache__/queues.cpython-37.pyc

B

� fC-�@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)�duplex�win32)Zsynchronizer�_maxsizer�Pipe�_reader�_writer�Lock�_rlock�os�getpid�_opid�sys�platform�_wlockZBoundedSemaphore�_sem�
_ignore_epipe�_after_forkr
r)�self�maxsize�ctx�r$�;/opt/alt/python37/lib64/python3.7/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|\|_|_|_|_|_|_|_|_|��dS)N)	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�_poll)r!r$r$r%r Cs


zQueue._after_forkTNc	Csd|jrtd�|���|j�||�s&t�|j�.|jdkr@|��|j	�
|�|j��WdQRXdS)NzQueue {0!r} has been closed)r4�AssertionError�formatr�acquirerr-r1�
_start_threadr0�append�notify)r!�obj�block�timeoutr$r$r%�putPs
z	Queue.putc	Cs�|r2|dkr2|j�|��}WdQRX|j��nr|rBt��|}|j�||�sTt�zB|rv|t��}|�|�s�t�n|��s�t�|��}|j��Wd|j��Xt	�
|�S)N)rr9r�release�timeZ	monotonicr>rr;�_ForkingPickler�loads)r!rCrD�resZdeadliner$r$r%�get[s&
z	Queue.getcCs|j|jj��S)N)rr�_semlockZ
_get_value)r!r$r$r%�qsizesszQueue.qsizecCs
|��S)N)r;)r!r$r$r%�emptywszQueue.emptycCs|jj��S)N)rrL�_is_zero)r!r$r$r%�fullzsz
Queue.fullcCs
|�d�S)NF)rK)r!r$r$r%�
get_nowait}szQueue.get_nowaitcCs|�|d�S)NF)rE)r!rBr$r$r%�
put_nowait�szQueue.put_nowaitcCs2d|_z|j��Wd|j}|r,d|_|�XdS)NT)r4r�closer5)r!rSr$r$r%rS�szQueue.closecCs.td�|jstd�|���|jr*|��dS)NzQueue.join_thread()zQueue {0!r} not closed)r
r4r<r=r2)r!r$r$r%�join_thread�szQueue.join_threadcCs6td�d|_y|j��Wntk
r0YnXdS)NzQueue.cancel_join_thread()T)r
r3r2Zcancel�AttributeError)r!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
r0�clearr+ZThreadr�_feedr-r7rrrSr�_on_queue_feeder_errorrr1Zdaemon�startr3r�_finalize_join�weakref�refr2�_finalize_closer5)r!r$r$r%r?�s*





zQueue._start_threadcCs4td�|�}|dk	r(|��td�ntd�dS)Nzjoining queue threadz... queue thread joinedz... queue thread already dead)r
�join)ZtwrZthreadr$r$r%r`�s
zQueue._finalize_joinc	Cs.td�|�|�t�|��WdQRXdS)Nztelling queue thread to quit)r
r@�	_sentinelrA)�buffer�notemptyr$r$r%rc�s
zQueue._finalize_closec
CsRtd�|j}|j}	|j}
|j}t}tjdkr<|j}
|j}nd}
�x
y�|�z|sX|
�Wd|	�Xybx\|�}||kr�td�|�dSt�	|�}|
dkr�||�qh|
�z||�Wd|�XqhWWnt
k
r�YnXWqDtk
�rH}zJ|�rt|dd�t
jk�rdSt��r&td|�dS|��|||�Wdd}~XYqDXqDWdS)Nz$starting thread to feed data to piperz%feeder thread got sentinel -- exiting�errnorzerror in queue thread: %s)r
r>rF�wait�popleftrerrrH�dumps�
IndexError�	Exception�getattrrhZEPIPErr)rfrgr6Z	writelockrSZignore_epipe�onerrorZ	queue_semZnacquireZnreleaseZnwaitZbpopleft�sentinelZwacquireZwreleaserB�er$r$r%r]�sR





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)rqrBrrr$r$r%r^
szQueue._on_queue_feeder_error)r)TN)TN)�__name__�
__module__�__qualname__r&r(r*r rErKrMrNrPrQrRrSrTrVr?�staticmethodr`rcr]r^r$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_tasksr,�_cond)r!r"r#r$r$r%r& szJoinableQueue.__init__cCst�|�|j|jfS)N)rr(ryrx)r!r$r$r%r(%szJoinableQueue.__getstate__cCs,t�||dd��|dd�\|_|_dS)N���)rr*ryrx)r!r)r$r$r%r*(szJoinableQueue.__setstate__TNc
Cs�|jrtd�|���|j�||�s&t�|j�J|j�8|jdkrH|�	�|j
�|�|j�
�|j��WdQRXWdQRXdS)NzQueue {0!r} is closed)r4r<r=rr>rr-ryr1r?r0r@rxrFrA)r!rBrCrDr$r$r%rE,s

zJoinableQueue.putc	Cs@|j�0|j�d�std��|jj��r2|j��WdQRXdS)NFz!task_done() called too many times)ryrxr>�
ValueErrorrLrOZ
notify_all)r!r$r$r%�	task_done8s
zJoinableQueue.task_donec	Cs,|j�|jj��s|j��WdQRXdS)N)ryrxrLrOri)r!r$r$r%rd?szJoinableQueue.join)r)TN)	rtrurvr&r(r*rEr|rdr$r$r$r%rs

c@s<eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
S)rcCsHtjdd�\|_|_|��|_|jj|_tj	dkr:d|_
n
|��|_
dS)NF)rr)rrrrrrr:r;rrr)r!r#r$r$r%r&Js


zSimpleQueue.__init__cCs
|��S)N)r;)r!r$r$r%rNSszSimpleQueue.emptycCst�|�|j|j|j|jfS)N)r	r'rrrr)r!r$r$r%r(Vs
zSimpleQueue.__getstate__cCs"|\|_|_|_|_|jj|_dS)N)rrrrr:r;)r!r)r$r$r%r*ZszSimpleQueue.__setstate__c	Cs&|j�|j��}WdQRXt�|�S)N)rrr8rHrI)r!rJr$r$r%rK^szSimpleQueue.getc	CsDt�|�}|jdkr"|j�|�n|j�|j�|�WdQRXdS)N)rHrkrrr6)r!rBr$r$r%rEds


zSimpleQueue.putN)	rtrurvr&rNr(r*rKrEr$r$r$r%rHs	)�__all__rrr+r.rGrarhZqueuerrZ_multiprocessing�rr	Z	reductionZForkingPicklerrH�utilr
rrr
r�objectrrerrr$r$r$r%�<module>
s$
s
*