????
Your IP : 3.138.86.166
a
�DOg�.�@s�gd�ZddlZddlZddlZddlZddlZddlZddlZddlZddl m
Z
mZddlZddl
mZddl
mZejjZddlmZmZmZmZmZGdd �d e�Ze�ZGd
d�de�ZGdd
�d
e�ZdS))�Queue�SimpleQueue�
JoinableQueue�N)�Empty�Full�)�
connection)�context)�debug�info�Finalize�register_after_fork�
is_exitingc@s�eZdZd-dd�Zdd�Zdd�Zdd �Zd.dd�Zd/dd�Zd0dd�Z dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd �Zd!d"�Zd#d$�Zed%d&��Zed'd(��Zed)d*��Zed+d,��ZdS)1rrcCs�|dkrddlm}||_tjdd�\|_|_|��|_t �
�|_tj
dkrTd|_n
|��|_|�|�|_d|_|��tj
dkr�t|tj�dS)Nrr)�
SEM_VALUE_MAXF��duplex�win32)�synchronizer�_maxsizer�Pipe�_reader�_writer�Lock�_rlock�os�getpid�_opid�sys�platform�_wlock�BoundedSemaphore�_sem�
_ignore_epipe�_resetr
r�_after_fork��self�maxsize�ctx�r)�./usr/lib64/python3.9/multiprocessing/queues.py�__init__%s
zQueue.__init__cCs.t�|�|j|j|j|j|j|j|j|j fS�N)
r �assert_spawningr"rrrrrr!r�r&r)r)r*�__getstate__9s
�zQueue.__getstate__c Cs0|\|_|_|_|_|_|_|_|_|��dSr,) r"rrrrrr!rr#�r&�stater)r)r*�__setstate__>s�zQueue.__setstate__cCstd�|jdd�dS)NzQueue._after_fork()T)�
after_fork)r
r#r.r)r)r*r$CszQueue._after_forkFcCsj|r|j��nt�t���|_t��|_d|_d|_ d|_
d|_d|_|j
j|_|jj|_|jj|_dS�NF)� _notempty�_at_fork_reinit� threading� Conditionr�collections�deque�_buffer�_thread�_jointhread�_joincancelled�_closed�_closer�
send_bytes�_send_bytesr�
recv_bytes�_recv_bytes�poll�_poll)r&r3r)r)r*r#Gs
zQueue._resetTNcCsz|jrtd|�d���|j�||�s(t�|j�8|jdurB|��|j� |�|j�
�Wd�n1sl0YdS�NzQueue z
is closed)r?�
ValueErrorr!�acquirerr5r<�
_start_threadr;�append�notify�r&�obj�block�timeoutr)r)r*�putVs
z Queue.putcCs�|jrtd|�d���|r\|dur\|j�|��}Wd�n1sF0Y|j��n||rlt��|}|j�||�s~t �zL|r�|t��}|�
|�s�t �n|�
�s�t �|��}|j��W|j��n|j��0t�|�SrG)
r?rHrrDr!�release�time� monotonicrIrrF�_ForkingPickler�loads)r&rOrP�res�deadliner)r)r*�getbs*&
z Queue.getcCs|j|jj��Sr,)rr!�_semlock�
_get_valuer.r)r)r*�qsize|szQueue.qsizecCs
|��Sr,�rFr.r)r)r*�empty�szQueue.emptycCs|jj��Sr,)r!rZ�_is_zeror.r)r)r*�full�sz
Queue.fullcCs
|�d�Sr4)rYr.r)r)r*�
get_nowait�szQueue.get_nowaitcCs|�|d�Sr4)rQ�r&rNr)r)r*�
put_nowait�szQueue.put_nowaitcCs d|_|j}|rd|_|�dS)NT)r?r@)r&�closer)r)r*rd�s
zQueue.closecCstd�|jr|��dS)NzQueue.join_thread())r
r=r.r)r)r*�join_thread�szQueue.join_threadcCs4td�d|_z|j��Wnty.Yn0dS)NzQueue.cancel_join_thread()T)r
r>r=�cancel�AttributeErrorr.r)r)r*�cancel_join_thread�szQueue.cancel_join_threadcCs�td�|j��tjtj|j|j|j|j |j
j|jj|j
|j|jf dd�|_d|j_td�|j��td�|js�t|jtjt�|j�gdd�|_t|tj|j|jgd d�|_dS)
NzQueue._start_thread()�QueueFeederThread)�target�args�nameTzdoing self._thread.start()z... done self._thread.start()���)�exitpriority�
)r
r;�clearr7�Threadr�_feedr5rBrrrdrr"�_on_queue_feeder_errorr!r<�daemon�startr>r�_finalize_join�weakref�refr=�_finalize_closer@r.r)r)r*rJ�s4
��
�
�zQueue._start_threadcCs4td�|�}|dur(|��td�ntd�dS)Nzjoining queue threadz... queue thread joinedz... queue thread already dead)r
�join)�twr�threadr)r)r*rv�s
zQueue._finalize_joincCsBtd�|�"|�t�|��Wd�n1s40YdS)Nztelling queue thread to quit)r
rK� _sentinelrL)�buffer�notemptyr)r)r*ry�s
zQueue._finalize_closec
Csrtd�|j} |j}
|j}|j}t}
tjdkr<|j}|j}nd}z�| �z|sT|�W|
�n|
�0zn|�}||
ur�td�|�|�WWdSt� |�}|dur�||�qh|�z||�W|�qh|�0qhWnt
y�Yn0Wq@t�yj}zf|�r$t|dd�t
jk�r$WYd}~dSt��rDtd|�WYd}~dS|��|||�WYd}~q@d}~00q@dS)Nz$starting thread to feed data to piperz%feeder thread got sentinel -- exiting�errnorzerror in queue thread: %s)r
rIrR�wait�popleftr}rrrU�dumps�
IndexError� Exception�getattrr��EPIPErr)r~rrA� writelock�reader_close�writer_close�ignore_epipe�onerror� queue_sem�nacquire�nrelease�nwait�bpopleft�sentinel�wacquire�wreleaserN�er)r)r*rr�sP
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�rNr�r)r)r*rsszQueue._on_queue_feeder_error)r)F)TN)TN)�__name__�
__module__�__qualname__r+r/r2r$r#rQrYr\r^r`rarcrdrerhrJ�staticmethodrvryrrrsr)r)r)r*r#s0
!
>rc@s@eZdZddd�Zdd�Zdd�Zdd
d�Zdd
�Zdd�Zd S)rrcCs*tj|||d�|�d�|_|��|_dS)N)r(r)rr+� Semaphore�_unfinished_tasksr8�_condr%r)r)r*r+(szJoinableQueue.__init__cCst�|�|j|jfSr,)rr/r�r�r.r)r)r*r/-szJoinableQueue.__getstate__cCs,t�||dd��|dd�\|_|_dS)N���)rr2r�r�r0r)r)r*r20szJoinableQueue.__setstate__TNc Cs�|jrtd|�d���|j�||�s(t�|j�h|j�B|jdurJ|��|j �
|�|j��|j�
�Wd�n1s~0YWd�n1s�0YdSrG)r?rHr!rIrr5r�r<rJr;rKr�rRrLrMr)r)r*rQ4s
zJoinableQueue.putcCsT|j�:|j�d�std��|jj��r2|j��Wd�n1sF0YdS)NFz!task_done() called too many times)r�r�rIrHrZr_�
notify_allr.r)r)r*� task_doneAs
zJoinableQueue.task_donecCs@|j�&|jj��s|j��Wd�n1s20YdSr,)r�r�rZr_r�r.r)r)r*rzHszJoinableQueue.join)r)TN) r�r�r�r+r/r2rQr�rzr)r)r)r*r&s
rc@sNeZdZdd�Zdd�Zdd�Zdd�Zd d
�Zdd�Zd
d�Z e
ej�Z
dS)rcCsHtjdd�\|_|_|��|_|jj|_tj dkr:d|_
n
|��|_
dS)NFrr)rrrrrrrErFrrr)r&r(r)r)r*r+Ss
zSimpleQueue.__init__cCs|j��|j��dSr,)rrdrr.r)r)r*rd\s
zSimpleQueue.closecCs
|��Sr,r]r.r)r)r*r^`szSimpleQueue.emptycCst�|�|j|j|j|jfSr,)r r-rrrrr.r)r)r*r/cs
zSimpleQueue.__getstate__cCs"|\|_|_|_|_|jj|_dSr,)rrrrrErFr0r)r)r*r2gszSimpleQueue.__setstate__cCs:|j�|j��}Wd�n1s&0Yt�|�Sr,)rrrCrUrV)r&rWr)r)r*rYks(zSimpleQueue.getcCsXt�|�}|jdur"|j�|�n2|j�|j�|�Wd�n1sJ0YdSr,)rUr�rrrArbr)r)r*rQqs
zSimpleQueue.putN)r�r�r�r+rdr^r/r2rYrQ�classmethod�types�GenericAlias�__class_getitem__r)r)r)r*rQs
r)�__all__rrr7r9rSr�rwr��queuerr�_multiprocessing�rr � reduction�ForkingPicklerrU�utilr
rrr
r�objectrr}rrr)r)r)r*�<module>
s&z
+