Your IP : 13.58.105.80


Current Path : /opt/alt/python35/lib64/python3.5/multiprocessing/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib64/python3.5/multiprocessing/__pycache__/resource_sharer.cpython-35.opt-2.pyc



���]��@s�ddlZddlZddlZddlZddlZddlmZddlmZddlmZdgZ	ej
dkr�e	dg7Z	Gd	d�de�Zn#e	d
g7Z	Gdd
�d
e�Z
Gdd
�d
e�Ze�ZejZdS)�N�)�process)�	reduction)�util�stop�win32�	DupSocketc@s(eZdZdd�Zdd�ZdS)rcs:|j���fdd�}tj|�j�|_dS)Ncs �j|�}|j|�dS)N)�share�
send_bytes)�conn�pidr	)�new_sock��4/opt/alt/python35/lib64/python3.5/resource_sharer.py�sendsz DupSocket.__init__.<locals>.send)�dup�_resource_sharer�register�close�_id)�self�sockrr)r
r�__init__szDupSocket.__init__c	Cs9tj|j�� }|j�}tj|�SWdQRXdS)N)r�get_connectionr�
recv_bytes�socketZ	fromshare)rrr	rrr�detach$szDupSocket.detachN)�__name__�
__module__�__qualname__rrrrrrrs�DupFdc@s(eZdZdd�Zdd�ZdS)r csLtj|���fdd�}�fdd�}tj||�|_dS)Ncstj|�|�dS)N)r�send_handle)rr)�new_fdrrr1szDupFd.__init__.<locals>.sendcstj��dS)N)�osrr)r"rrr3szDupFd.__init__.<locals>.close)r#rrrr)r�fdrrr)r"rr/szDupFd.__init__c	Cs-tj|j��}tj|�SWdQRXdS)N)rrrr�recv_handle)rrrrrr7szDupFd.detachN)rrrrrrrrrr -sc@smeZdZdd�Zdd�Zedd��Zddd	�Zd
d�Zdd
�Z	dd�Z
dS)�_ResourceSharercCs\d|_i|_g|_tj�|_d|_d|_d|_t	j
|tj�dS)Nr)
�_key�_cache�
_old_locks�	threading�Lock�_lock�	_listener�_address�_threadr�register_after_forkr&�
_afterfork)rrrrr?s						z_ResourceSharer.__init__c
Csc|j�S|jdkr#|j�|jd7_||f|j|j<|j|jfSWdQRXdS)Nr)r,r.�_startr'r()rrrrrrrIs

z_ResourceSharer.registercCsTddlm}|\}}||dtj�j�}|j|tj�f�|S)Nr)�Client�authkey)�
connectionr3r�current_processr4rr#�getpid)�identr3�address�key�crrrrRs
z_ResourceSharer.get_connectionNcCs�ddlm}|j��|jdk	r�||jdtj�j�}|jd�|j�|j	j
|�|j	j�r�tj
d�|jj�d|_	d|_d|_x*|jj�D]\}\}}|�q�W|jj�WdQRXdS)Nr)r3r4z._ResourceSharer thread did not stop when asked)r5r3r,r.rr6r4rrr/�join�is_aliver�sub_warningr-r(�items�clear)r�timeoutr3r;r:rrrrrr[s"




			"z_ResourceSharer.stopcCs�x*|jj�D]\}\}}|�qW|jj�|jj|j�tj�|_|jdk	rx|jj	�d|_d|_
d|_dS)N)r(r?r@r)�appendr,r*r+r-rr.r/)rr:rrrrrr1ps"

		z_ResourceSharer._afterforkcCs|ddlm}tjd�|dtj�j�|_|jj|_	t
jd|j�}d|_
|j�||_dS)Nr)�Listenerz0starting listener and thread for sending handlesr4�targetT)r5rCr�debugrr6r4r-r9r.r*�Thread�_serve�daemon�startr/)rrC�trrrr2~s
	
z_ResourceSharer._startcCs�ttd�r.tjtjtdtj��x�yv|jj��`}|j�}|dkr_P|\}}|j	j
|�\}}z|||�Wd|�XWdQRXWq1tj�s�t
jt
j��Yq1Xq1WdS)N�pthread_sigmaskr)�hasattr�signalrK�	SIG_BLOCK�range�NSIGr-�accept�recvr(�popr�
is_exiting�sys�
excepthook�exc_info)rr�msgr:�destination_pidrrrrrrG�s z_ResourceSharer._serve)rrrrr�staticmethodrrr1r2rGrrrrr&=s
		r&)r#rMrrUr*�rrr�__all__�platform�objectrr r&rrrrrr�<module>s 	

`	

?>