AlkantarClanX12

Your IP : 3.147.13.220


Current Path : /opt/alt/python39/lib64/python3.9/multiprocessing/__pycache__/
Upload File :
Current File : //opt/alt/python39/lib64/python3.9/multiprocessing/__pycache__/resource_tracker.cpython-39.pyc

a

R�f�!�@s�ddlZddlZddlZddlZddlZddlmZddlmZgd�Ze	ed�Z
ejejfZ
ddd	�iZejd
kr�ddlZddlZe�ejejd��Gdd
�d
e�Ze�ZejZejZejZejZdd�ZdS)�N�)�spawn)�util)�ensure_running�register�
unregister�pthread_sigmaskZnoopcCsdS�N�r
r
r
�E/opt/alt/python39/lib64/python3.9/multiprocessing/resource_tracker.py�<lambda>!�r�posix)Z	semaphoreZ
shared_memoryc@sLeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dS)�ResourceTrackercCst��|_d|_d|_dSr	)�	threadingZLock�_lock�_fd�_pid��selfr
r
r�__init__0s
zResourceTracker.__init__cCsj|j�P|jdur"Wd�dSt�|j�d|_t�|jd�d|_Wd�n1s\0YdS)Nr)rr�os�close�waitpidrrr
r
r�_stop5s
zResourceTracker._stopcCs|��|jSr	)rrrr
r
r�getfdBszResourceTracker.getfdcCs�|j���|jdur~|��r,Wd�dSt�|j�z|jdurRt�|jd�WntyfYn0d|_d|_t�	d�g}z|�
tj�
��Wnty�Yn0d}t��\}}z�z�|�
|�t��}|gt��}|d||g7}z:t�rt�tjt�t�|||�}Wt�r@t�tjt�nt�r>t�tjt�0Wnt�|��Yn0||_||_Wt�|�nt�|�0Wd�n1�s�0YdS)z�Make sure that resource tracker process is running.

        This can be run from any process.  Usually a child process will use
        the resource created by its parent.NrzUresource_tracker: process died unexpectedly, relaunching.  Some resources might leak.z:from multiprocessing.resource_tracker import main;main(%d)z-c)rr�_check_aliverrrr�ChildProcessError�warnings�warn�append�sys�stderr�fileno�	Exception�piperZget_executablerZ_args_from_interpreter_flags�
_HAVE_SIGMASK�signalr�	SIG_BLOCK�_IGNORED_SIGNALSZspawnv_passfds�SIG_UNBLOCK)rZfds_to_pass�cmd�r�wZexe�args�pidr
r
rrFsN




�
zResourceTracker.ensure_runningcCs0zt�|jd�Wnty&YdS0dSdS)z;Check that the pipe has not been closed by sending a probe.s
PROBE:0:noop
FTN)r�writer�OSErrorrr
r
rr�s
zResourceTracker._check_alivecCs|�d||�dS)z0Register name of resource with resource tracker.�REGISTERN��_send�r�name�rtyper
r
rr�szResourceTracker.registercCs|�d||�dS)z2Unregister name of resource with resource tracker.�
UNREGISTERNr3r5r
r
rr�szResourceTracker.unregistercCsb|��d�|||��d�}t|�dkr0td��t�|j|�}|t|�ks^Jd�|t|����dS)Nz{0}:{1}:{2}
�asciiiz
name too longznbytes {0:n} but len(msg) {1:n})r�format�encode�len�
ValueErrorrr0r)rr+r6r7�msg�nbytesr
r
rr4�s�zResourceTracker._sendN)�__name__�
__module__�__qualname__rrrrrrrr4r
r
r
rr.s
@rc
Cs�t�tjtj�t�tjtj�tr2t�tjt�tj	tj
fD]$}z|��Wq>ty`Yq>0q>dd�t
��D�}�z�t|d���}|D]�}z�|���d��d�\}}}t
�|d�}|dur�td|�d|����|d	kr�||�|�n2|d
k�r||�|�n|dk�rntd|��Wq�t�yRztjt���WnYn0Yq�0q�Wd�n1�sl0YW|��D]�\}}|�r�zt�d
t|�|f�Wnt�y�Yn0|D]X}zNzt
||�Wn8t�y}	zt�d||	f�WYd}	~	n
d}	~	00Wn0�qq�n�|��D]�\}}|�rhzt�d
t|�|f�Wnt�yfYn0|D]X}zNzt
||�Wn8t�y�}	zt�d||	f�WYd}	~	n
d}	~	00Wn0�ql�q*0dS)zRun resource tracker.cSsi|]}|t��qSr
)�set)�.0r7r
r
r�
<dictcomp>�r
zmain.<locals>.<dictcomp>�rbr9�:NzCannot register z. for automatic cleanup: unknown resource type r2r8ZPROBEzunrecognized command %rzQresource_tracker: There appear to be %d leaked %s objects to clean up at shutdownzresource_tracker: %r: %s)r'�SIGINT�SIG_IGN�SIGTERMr&rr*r)r!�stdin�stdoutrr$�_CLEANUP_FUNCS�keys�open�strip�decode�split�getr=�add�remove�RuntimeError�
excepthook�exc_info�itemsrrr<)
�fd�f�cache�liner+r6r7Zcleanup_funcZrtype_cache�er
r
r�main�s���

0
�
*�
�
*r_)rr'r!rr�rr�__all__�hasattrr&rHrJr)rMr6Z_multiprocessingZ_posixshmem�updateZ
sem_unlinkZ
shm_unlink�objectrZ_resource_trackerrrrrr_r
r
r
r�<module>s2
�
�w