%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /snap/core20/current/lib/python3.8/multiprocessing/__pycache__/
Upload File :
Create Path :
Current File : //snap/core20/current/lib/python3.8/multiprocessing/__pycache__/resource_tracker.cpython-38.pyc

U

k�]e�!�@s�ddlZddlZddlZddlZddlZddlmZddlmZdddgZe	ed�Z
ejejfZ
d	d
d�iZejdkr�ddlZddlZe�ejejd
��Gdd�de�Ze�ZejZejZejZejZdd�ZdS)�N�)�spawn)�util�ensure_running�register�
unregister�pthread_sigmaskZnoopcCsdS�N�r
r
r
�6/usr/lib/python3.8/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__c	CsT|j�D|jdkr W5QR�dSt�|j�d|_t�|jd�d|_W5QRXdS)Nr)rr�os�close�waitpidrrr
r
r�_stop5s
zResourceTracker._stopcCs|��|jSr	)rrrr
r
r�getfdBszResourceTracker.getfdcCst|j��b|jdk	r~|��r*W5QR�dSt�|j�z|jdk	rPt�|jd�Wntk
rfYnXd|_d|_t�	d�g}z|�
tj�
��Wntk
r�YnXd}t��\}}z�zr|�
|�t��}|gt��}|d||g7}z&t�rt�tjt�t�|||�}W5t�r,t�tjt�XWnt�|��YnX||_||_W5t�|�XW5QRXdS)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_UNBLOCK�_IGNORED_SIGNALS�	SIG_BLOCKZspawnv_passfds)rZfds_to_pass�cmd�r�wZexe�args�pidr
r
rrFsJ






zResourceTracker.ensure_runningcCs2zt�|jd�Wntk
r(YdSXdSdS)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^td�|t|����dS)Nz{0}:{1}:{2}
�asciiiz
name too longznbytes {0:n} but len(msg) {1:n})	r�format�encode�len�
ValueErrorrr0r�AssertionError)rr+r6r7�msg�nbytesr
r
rr4�s�zResourceTracker._sendN)�__name__�
__module__�__qualname__rrrrrrrr4r
r
r
rr.s
@rc
Cst�tjtj�t�tjtj�tr2t�tjt�tj	tj
fD]&}z|��Wq>tk
rbYq>Xq>dd�t
��D�}z�t|d���}|D]�}z�|���d��d�\}}}t
�|d�}	|	dkr�td	|�d
|����|dkr�||�|�n2|dk�r||�|�n|d
k�rntd|��Wq�tk
�rTztjt���WnYnXYq�Xq�W5QRXW5|��D]�\}}|�r�zt�dt|�|f�Wntk
�r�YnX|D]V}zLzt
||�Wn6tk
�r�}zt�d||f�W5d}~XYnXW5X�q��qnXdS)zRun resource tracker.cSsi|]}|t��qSr
)�set)�.0r7r
r
r�
<dictcomp>�szmain.<locals>.<dictcomp>zQresource_tracker: There appear to be %d leaked %s objects to clean up at shutdownzresource_tracker: %r: %sN�rbr9�:zCannot register z. for automatic cleanup: unknown resource type r2r8ZPROBEzunrecognized command %r)r'�SIGINT�SIG_IGN�SIGTERMr&rr(r)r!�stdin�stdoutrr$�_CLEANUP_FUNCS�keys�itemsrrr<�open�strip�decode�split�getr=�add�remove�RuntimeError�
excepthook�exc_info)
�fd�f�cacher7Zrtype_cacher6�e�liner+Zcleanup_funcr
r
r�main�s^�


�
(r`)rr'r!rr�rr�__all__�hasattrr&rIrKr)rNr6Z_multiprocessingZ_posixshmem�updateZ
sem_unlinkZ
shm_unlink�objectrZ_resource_trackerrrrrr`r
r
r
r�<module>s4

�
�w

Zerion Mini Shell 1.0