Your IP : 18.117.94.221


Current Path : /opt/alt/python310/lib64/python3.10/multiprocessing/__pycache__/
Upload File :
Current File : //opt/alt/python310/lib64/python3.10/multiprocessing/__pycache__/queues.cpython-310.pyc

o

6��f�.�@s�gd�ZddlZddlZddlZddlZddlZddlZddlZddlZddl	m
Z
mZddlZddl
mZddl
mZejjZddlmZmZmZmZmZGdd	�d	e�Ze�ZGd
d�de�ZGdd
�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�Zd/dd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd �Zd!d"�Zd#d$�Zed%d&��Zed'd(��Zed)d*��Zed+d,��ZdS)0rrcCs�|dkr
ddlm}||_tjdd�\|_|_|��|_t	�
�|_tj
dkr*d|_n|��|_|�|�|_d|_|��tj
dkrIt|tj�dSdS)Nrr)�
SEM_VALUE_MAXF�Zduplex�win32)Zsynchronizer�_maxsizer�Pipe�_reader�_writer�Lock�_rlock�os�getpid�_opid�sys�platform�_wlockZBoundedSemaphore�_sem�
_ignore_epipe�_resetr
r�_after_fork��self�maxsize�ctx�r&�=/opt/alt/python310/lib64/python3.10/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__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#r0r&r&r'r Gs


zQueue._resetTNcCs||jrtd|�d���|j�||�st�|j�|jdur!|��|j�	|�|j�
�Wd�dS1s7wYdS�NzQueue z
 is closed)r<�
ValueErrorr�acquirerr2r9�
_start_threadr8�append�notify�r#�obj�block�timeoutr&r&r'�putVs
"�z	Queue.putcCs�|jrtd|�d���|r.|dur.|j�|��}Wd�n1s#wY|j��n>|r6t��|}|j�||�s?t	�z&|rP|t��}|�
|�sOt	�n|�
�sVt	�|��}|j��W|j��n|j��wt�|�SrD)
r<rErrAr�release�time�	monotonicrFrrC�_ForkingPickler�loads)r#rLrM�resZdeadliner&r&r'�getbs.
�
�
z	Queue.getcCs|j|jj��Sr))rr�_semlockZ
_get_valuer+r&r&r'�qsize|szQueue.qsizecC�
|��Sr)�rCr+r&r&r'�empty��
zQueue.emptycCs|jj��Sr))rrV�_is_zeror+r&r&r'�full��z
Queue.fullcCs
|�d�Sr1)rUr+r&r&r'�
get_nowait�r[zQueue.get_nowaitcCs|�|d�Sr1)rN�r#rKr&r&r'�
put_nowait�r^zQueue.put_nowaitcCs$d|_|j}|rd|_|�dSdS)NT)r<r=)r#�closer&r&r'rb�s
�zQueue.closecCs2td�|jsJd�|���|jr|��dSdS)NzQueue.join_thread()zQueue {0!r} not closed)r
r<�formatr:r+r&r&r'�join_thread�s
�zQueue.join_threadcCs4td�d|_z|j��WdStyYdSw)NzQueue.cancel_join_thread()T)r
r;r:Zcancel�AttributeErrorr+r&r&r'�cancel_join_thread�s�zQueue.cancel_join_threadcCs�td�|j��tjtj|j|j|j|j	|j
j|jj|j
|j|jf	dd�|_d|j_td�|j��td�|jsKt|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
r8�clearr4ZThreadr�_feedr2r?rrrbrr�_on_queue_feeder_errorrr9Zdaemon�startr;r�_finalize_join�weakref�refr:�_finalize_closer=r+r&r&r'rG�s4
��
�
�zQueue._start_threadcCs6td�|�}|dur|��td�dStd�dS)Nzjoining queue threadz... queue thread joinedz... queue thread already dead)r
�join)Ztwr�threadr&r&r'rp�szQueue._finalize_joincCsDtd�|�|�t�|��Wd�dS1swYdS)Nztelling queue thread to quit)r
rH�	_sentinelrI)�buffer�notemptyr&r&r'rs�s


"�zQueue._finalize_closec	
Csftd�|j}	|j}
|j}|j}t}
tjdkr|j}|j}nd}	zT|	�z
|s+|�W|
�n|
�wz6	|�}||
urKtd�|�|�WWdSt�	|�}|durY||�n|�z	||�W|�n|�wq6t
ysYnwWn<ty�}z0|r�t|dd�t
jkr�WYd}~dSt�r�td|�WYd}~dS|��|||�WYd}~nd}~wwq!)Nz$starting thread to feed data to piperrz%feeder thread got sentinel -- exiting�errnorzerror in queue thread: %s)r
rFrO�wait�popleftrvrrrR�dumps�
IndexError�	Exception�getattrryZEPIPErr)rwrxr>Z	writelockZreader_closeZwriter_closeZignore_epipe�onerrorZ	queue_semZnacquireZnreleaseZnwaitZbpopleftZsentinelZwacquireZwreleaserK�er&r&r'rm�sb
�


��
���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�rKr�r&r&r'rnszQueue._on_queue_feeder_error�r)F�TN)�__name__�
__module__�__qualname__r(r,r/r!r rNrUrWrZr]r_rarbrdrfrG�staticmethodrprsrmrnr&r&r&r'r#s2



!
	

>rc@s@eZdZddd�Zdd�Zdd�Zdd
d�Zdd
�Zdd�Zd	S)rrcCs*tj|||d�|�d�|_|��|_dS)N)r%r)rr(Z	Semaphore�_unfinished_tasksr5�_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/0szJoinableQueue.__setstate__TNc	Cs�|jrtd|�d���|j�||�st�|j�=|j�!|jdur%|��|j	�
|�|j��|j�
�Wd�n1s?wYWd�dSWd�dS1sWwYdSrD)r<rErrFrr2r�r9rGr8rHr�rOrIrJr&r&r'rN4s

P�zJoinableQueue.putcCsf|j�&|j�d�std��|jj��r!|j��Wd�dSWd�dS1s,wYdS)NFz!task_done() called too many times)r�r�rFrErVr\Z
notify_allr+r&r&r'�	task_doneAs�"�zJoinableQueue.task_donecCsR|j�|jj��s|j��Wd�dSWd�dS1s"wYdSr))r�r�rVr\rzr+r&r&r'rtHs�"�zJoinableQueue.joinr�r�)	r�r�r�r(r,r/rNr�rtr&r&r&r'r&s


rc@sNeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	e
ej�Z
dS)rcCsJtjdd�\|_|_|��|_|jj|_tj	dkrd|_
dS|��|_
dS)NFrr)rrrrrrrBrCrrr)r#r%r&r&r'r(Ss



zSimpleQueue.__init__cCs|j��|j��dSr))rrbrr+r&r&r'rb\s
zSimpleQueue.closecCrXr)rYr+r&r&r'rZ`r[zSimpleQueue.emptycCst�|�|j|j|j|jfSr))r	r*rrrrr+r&r&r'r,cs
zSimpleQueue.__getstate__cCs"|\|_|_|_|_|jj|_dSr))rrrrrBrCr-r&r&r'r/gszSimpleQueue.__setstate__cCs:|j�
|j��}Wd�n1swYt�|�Sr))rrr@rRrS)r#rTr&r&r'rUks�
zSimpleQueue.getcCs\t�|�}|jdur|j�|�dS|j�|j�|�Wd�dS1s'wYdSr))rRr|rrr>r`r&r&r'rNqs

"�zSimpleQueue.putN)r�r�r�r(rbrZr,r/rUrN�classmethod�types�GenericAlias�__class_getitem__r&r&r&r'rQs	
r)�__all__rrr4r6rPr�rqry�queuerrZ_multiprocessing�rr	Z	reductionZForkingPicklerrR�utilr
rrr
r�objectrrvrrr&r&r&r'�<module>s(	z
+

?>