HEX
Server: Apache
System: Linux server2.voipitup.com.au 4.18.0-553.104.1.lve.el8.x86_64 #1 SMP Tue Feb 10 20:07:30 UTC 2026 x86_64
User: posscale (1027)
PHP: 8.2.29
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //opt/saltstack/salt/lib/python3.10/multiprocessing/__pycache__/resource_sharer.cpython-310.pyc
o

�N�g�@s�ddlZddlZddlZddlZddlZddlmZddlmZddlm	Z	dgZ
ejdkr<e
dg7Z
Gd	d�de�Z
n
e
d
g7Z
Gdd
�d
e�ZGdd
�d
e�Ze�ZejZdS)�N�)�process)�	reduction)�util�stop�win32�	DupSocketc@� eZdZdZdd�Zdd�ZdS)rzPicklable wrapper for a socket.cs(|����fdd�}t�|�j�|_dS)Ncs��|�}|�|�dS�N)�shareZ
send_bytes)�conn�pidr�Znew_sock��E/opt/saltstack/salt/lib/python3.10/multiprocessing/resource_sharer.py�sends
z DupSocket.__init__.<locals>.send)�dup�_resource_sharer�register�close�_id)�self�sockrrrr�__init__szDupSocket.__init__cCsBt�|j��}|��}t�|�Wd�S1swYdS)z1Get the socket.  This should only be called once.N)r�get_connectionrZ
recv_bytes�socketZ	fromshare)rrrrrr�detach$s$�zDupSocket.detachN��__name__�
__module__�__qualname__�__doc__rrrrrrrs�DupFdc@r	)r"z-Wrapper for fd which can be used at any time.cs4t�|���fdd�}�fdd�}t�||�|_dS)Ncst�|�|�dSr
)rZsend_handle)rr
�Znew_fdrrr1szDupFd.__init__.<locals>.sendcst���dSr
)�osrrr#rrr3szDupFd.__init__.<locals>.close)r$rrrr)r�fdrrrr#rr/s
zDupFd.__init__cCs:t�|j��
}t�|�Wd�S1swYdS)z-Get the fd.  This should only be called once.N)rrrrZrecv_handle)rrrrrr7s$�zDupFd.detachNrrrrrr"-sc@sNeZdZdZdd�Zdd�Zedd��Zdd	d
�Zdd�Z	d
d�Z
dd�ZdS)�_ResourceSharerz.Manager for resources using background thread.cCs:d|_i|_t��|_d|_d|_d|_t�	|t
j�dS)Nr)�_key�_cache�	threading�Lock�_lock�	_listener�_address�_threadrZregister_after_forkr&�
_afterfork)rrrrr?s
z_ResourceSharer.__init__cCsf|j�&|jdur
|��|jd7_||f|j|j<|j|jfWd�S1s,wYdS)z+Register resource, returning an identifier.Nr)r+r-�_startr'r()rrrrrrrHs

$�z_ResourceSharer.registercCs<ddlm}|\}}||t��jd�}|�|t��f�|S)z<Return connection from which to receive identified resource.r��Client��authkey)�
connectionr2r�current_processr4rr$�getpid)�identr2�address�key�crrrrQs
z_ResourceSharer.get_connectionNcCs�ddlm}|j�[|jdur\||jt��jd�}|�d�|��|j	�
|�|j	��r2t�
d�|j��d|_	d|_d|_|j��D]	\}\}}|�qE|j��Wd�dSWd�dS1sgwYdS)z:Stop the background thread and clear registered resources.rr1Nr3z._ResourceSharer thread did not stop when asked)r5r2r+r-rr6r4rrr.�join�is_aliverZsub_warningr,r(�items�clear)r�timeoutr2r;r:rrrrrrZs*
�



�"�z_ResourceSharer.stopcCs\|j��D]	\}\}}|�q|j��|j��|jdur#|j��d|_d|_d|_dSr
)	r(r>r?r+�_at_fork_reinitr,rr-r.)rr:rrrrrr/os




z_ResourceSharer._afterforkcCsjddlm}|jdusJd��t�d�|t��jd�|_|jj|_	t
j|jd�}d|_
|��||_dS)Nr)�ListenerzAlready have Listenerz0starting listener and thread for sending handlesr3)�targetT)r5rBr,r�debugrr6r4r9r-r)�Thread�_serve�daemon�startr.)rrB�trrrr0zs


z_ResourceSharer._startcCs�ttd�rt�tjt���	zD|j���5}|��}|dur(	Wd�WdS|\}}|j�	|�\}}z
|||�W|�n|�wWd�n1sMwYWnt
��sbtj
t���Yq)N�pthread_sigmask)�hasattr�signalrJ�	SIG_BLOCK�
valid_signalsr,�accept�recvr(�poprZ
is_exiting�sys�
excepthook�exc_info)rr�msgr:Zdestination_pidrrrrrrF�s*
���
��z_ResourceSharer._server
)rrr r!rr�staticmethodrrr/r0rFrrrrr&=s		

r&)r$rLrrRr)�r�contextrr�__all__�platform�objectrr"r&rrrrrr�<module>s"



\