AlkantarClanX12

Your IP : 18.223.195.127


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

B

YI~d��@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�stop�win32�	DupSocketc@seZdZdd�Zdd�ZdS)rcs(|����fdd�}t�|�j�|_dS)Ncs��|�}|�|�dS)N)�shareZ
send_bytes)�conn�pidr	)�new_sock��D/opt/alt/python37/lib64/python3.7/multiprocessing/resource_sharer.py�sends
z DupSocket.__init__.<locals>.send)�dup�_resource_sharer�register�close�_id)�selfZsockrr
)rr�__init__szDupSocket.__init__c	Cs*t�|j��}|��}t�|�SQRXdS)N)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�|�|�dS)N)rZsend_handle)r
r)�new_fdr
rr1szDupFd.__init__.<locals>.sendcst���dS)N)�osrr
)rr
rr3szDupFd.__init__.<locals>.close)rrrrr)r�fdrrr
)rrr/s
zDupFd.__init__c	Cs"t�|j��}t�|�SQRXdS)N)rrrrZrecv_handle)rr
r
r
rr7szDupFd.detachN)rrrrrr
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	CsN|j�>|jdkr|��|jd7_||f|j|j<|j|jfSQRXdS)Nr)r'r)�_startr"r#)rrrr
r
rrIs
z_ResourceSharer.registercCs<ddlm}|\}}||t��jd�}|�|t��f�|S)Nr)�Client)�authkey)�
connectionr-r�current_processr.rr�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|_x |j��D]\}\}}|�q�W|j��WdQRXdS)Nr)r-)r.z._ResourceSharer thread did not stop when asked)r/r-r'r)rr0r.rrr*�joinZis_aliverZsub_warningr(r#�items�clear)rZtimeoutr-r4r3rrr
r
rr[s"





z_ResourceSharer.stopcCsnx |j��D]\}\}}|�qW|j��|j�|j�t��|_|jdk	rX|j�	�d|_d|_
d|_dS)N)r#r6r7r$�appendr'r%r&r(rr)r*)rr3rrr
r
rr+ps




z_ResourceSharer._afterforkcCsXddlm}t�d�|t��jd�|_|jj|_	t
j|jd�}d|_
|��||_dS)Nr)�Listenerz0starting listener and thread for sending handles)r.)�targetT)r/r9r�debugrr0r.r(r2r)r%ZThread�_serveZdaemon�startr*)rr9�tr
r
rr,~s

z_ResourceSharer._startc	Cs�ttd�r t�tjtdtj��x�y\|j���H}|��}|dkrBP|\}}|j	�
|�\}}z|||�Wd|�XWdQRXWq"t��s�t
jt
���Yq"Xq"WdS)N�pthread_sigmaskr)�hasattr�signalr?�	SIG_BLOCK�range�NSIGr(ZacceptZrecvr#�poprZ
is_exiting�sys�
excepthook�exc_info)rr
�msgr3Zdestination_pidrrr
r
rr<�s 
z_ResourceSharer._serve)N)rrrrr�staticmethodrrr+r,r<r
r
r
rr!=s
		
r!)rrArrFr%�r�contextrr�__all__�platform�objectrrr!rrr
r
r
r�<module>s 


`