AlkantarClanX12

Your IP : 3.142.172.190


Current Path : /opt/alt/python38/lib64/python3.8/multiprocessing/__pycache__/
Upload File :
Current File : //opt/alt/python38/lib64/python3.8/multiprocessing/__pycache__/resource_sharer.cpython-38.opt-2.pyc

U

i�f��@s�ddlZddlZddlZddlZddlZddlmZddlmZddlm	Z	dgZ
ejdkrxe
dg7Z
Gd	d�de�Z
ne
d
g7Z
Gdd
�d
e�ZGdd
�d
e�Ze�ZejZdS)�N�)�process)�	reduction)�util�stopZwin32�	DupSocketc@seZdZdd�Zdd�ZdS)rcs(|����fdd�}t�|�j�|_dS)Ncs��|�}|�|�dS�N)�shareZ
send_bytes)�conn�pidr	�Znew_sock��D/opt/alt/python38/lib64/python3.8/multiprocessing/resource_sharer.py�sends
z DupSocket.__init__.<locals>.send)�dup�_resource_sharer�register�close�_id)�selfZsockrr
rr�__init__szDupSocket.__init__c
Cs6t�|j�� }|��}t�|�W5QR�SQRXdSr)r�get_connectionrZ
recv_bytes�socketZ	fromshare)rr
r	r
r
r�detach$szDupSocket.detachN��__name__�
__module__�__qualname__rrr
r
r
rrs�DupFdc@seZdZdd�Zdd�ZdS)rcs4t�|���fdd�}�fdd�}t�||�|_dS)Ncst�|�|�dSr)rZsend_handle)r
r�Znew_fdr
rr1szDupFd.__init__.<locals>.sendcst���dSr)�osrr
rr
rr3szDupFd.__init__.<locals>.close)r rrrr)r�fdrrr
rrr/s
zDupFd.__init__c
Cs.t�|j��}t�|�W5QR�SQRXdSr)rrrrZrecv_handle)rr
r
r
rr7szDupFd.detachNrr
r
r
rr-sc@sJeZdZdd�Zdd�Zedd��Zddd	�Zd
d�Zdd
�Z	dd�Z
dS)�_ResourceSharercCs@d|_i|_g|_t��|_d|_d|_d|_t	�
|tj�dS)Nr)
�_key�_cache�
_old_locks�	threading�Lock�_lock�	_listener�_address�_threadrZregister_after_forkr"�
_afterfork)rr
r
rr?s
z_ResourceSharer.__init__c
CsZ|j�J|jdkr|��|jd7_||f|j|j<|j|jfW5QR�SQRXdS)Nr)r(r*�_startr#r$)rrrr
r
rrIs
z_ResourceSharer.registercCs<ddlm}|\}}||t��jd�}|�|t��f�|S)Nr��Client��authkey)�
connectionr/r�current_processr1rr �getpid)Zidentr/�address�key�cr
r
rrRs
z_ResourceSharer.get_connectionNc	Cs�ddlm}|j��|jdk	r�||jt��jd�}|�d�|��|j	�
|�|j	��rdt�
d�|j��d|_	d|_d|_|j��D]\}\}}|�q�|j��W5QRXdS)Nrr.r0z._ResourceSharer thread did not stop when asked)r2r/r(r*rr3r1rrr+�joinZis_aliverZsub_warningr)r$�items�clear)rZtimeoutr/r7r6rrr
r
rr[s$
�



z_ResourceSharer.stopcCsj|j��D]\}\}}|�q
|j��|j�|j�t��|_|jdk	rT|j�	�d|_d|_
d|_dSr)r$r9r:r%�appendr(r&r'r)rr*r+)rr6rrr
r
rr,ps



z_ResourceSharer._afterforkcCsXddlm}t�d�|t��jd�|_|jj|_	t
j|jd�}d|_
|��||_dS)Nr)�Listenerz0starting listener and thread for sending handlesr0)�targetT)r2r<r�debugrr3r1r)r5r*r&ZThread�_serveZdaemon�startr+)rr<�tr
r
rr-~s

z_ResourceSharer._startc	Cs�ttd�rt�tjt���zh|j���T}|��}|dkrHW5QR�Wq�|\}}|j�	|�\}}z|||�W5|�XW5QRXWqt
��s�tj
t���YqXqdS)N�pthread_sigmask)�hasattr�signalrB�	SIG_BLOCK�
valid_signalsr)ZacceptZrecvr$�poprZ
is_exiting�sys�
excepthook�exc_info)rr
�msgr6Zdestination_pidrrr
r
rr?�s
z_ResourceSharer._serve)N)rrrrr�staticmethodrrr,r-r?r
r
r
rr"=s
	

r")r rDrrHr&�r�contextrr�__all__�platform�objectrrr"rrr
r
r
r�<module>s 


`