Your IP : 18.216.161.178
U
e5d�! � @ s� d dl Z d dlZd dlZd dlZd dlZddlmZ ddlmZ dddgZe ed�Z
ejejfZ
d d
d� iZe jdkr�d dlZd dlZe�ejejd
�� G dd� de�Ze� ZejZejZejZejZdd� ZdS )� N� )�spawn)�util�ensure_running�register�
unregister�pthread_sigmaskZnoopc C s d S �N� r
r
r
�8/usr/lib64/python3.8/multiprocessing/resource_tracker.py�<lambda>! � r �posix)Z semaphoreZ
shared_memoryc @ sL e Zd Zdd� Zdd� Zdd� Zdd� Zd d
� Zdd� Zd
d� Z dd� Z
dS )�ResourceTrackerc C s t �� | _d | _d | _d S r )� threadingZLock�_lock�_fd�_pid��selfr
r
r �__init__0 s
zResourceTracker.__init__c C sT | j �D | jd kr W 5 Q R � d S t�| j� d | _t�| jd� d | _W 5 Q R X d S )Nr )r r �os�close�waitpidr r r
r
r �_stop5 s
zResourceTracker._stopc C s | � � | jS r )r r r r
r
r �getfdB s zResourceTracker.getfdc C st | j ��b | jd k r~| �� r*W 5 Q R � d S t�| j� z| jd k rPt�| jd� W n tk
rf Y nX d | _d | _t� d� g }z|�
tj�
� � W n tk
r� Y nX d}t�� \}}z�zr|�
|� t�� }|gt�� }|d|| g7 }z&t�rt�tjt� t�|||�}W 5 t�r,t�tjt� X W n t�|� � Y nX || _|| _W 5 t�|� X W 5 Q R X d S )Nr zUresource_tracker: process died unexpectedly, relaunching. Some resources might leak.z:from multiprocessing.resource_tracker import main;main(%d)z-c)r r �_check_aliver r r r �ChildProcessError�warnings�warn�append�sys�stderr�fileno� Exception�piper Zget_executabler Z_args_from_interpreter_flags�
_HAVE_SIGMASK�signalr �SIG_UNBLOCK�_IGNORED_SIGNALS� SIG_BLOCKZspawnv_passfds)r Zfds_to_pass�cmd�r�wZexe�args�pidr
r
r r F sJ
zResourceTracker.ensure_runningc C s2 zt �| jd� W n tk
r( Y dS X dS d S )Ns
PROBE:0:noop
FT)r �writer �OSErrorr r
r
r r � s
zResourceTracker._check_alivec C s | � d||� d S )N�REGISTER��_send�r �name�rtyper
r
r r � s zResourceTracker.registerc C s | � d||� d S )N�
UNREGISTERr3 r5 r
r
r r � s zResourceTracker.unregisterc C sB | � � d�|||��d�}t|�dkr0td��t�| j|�}d S )Nz{0}:{1}:{2}
�asciii z
name too long)r �format�encode�len�
ValueErrorr r0 r )r r+ r6 r7 �msg�nbytesr
r
r r4 � s zResourceTracker._sendN)�__name__�
__module__�__qualname__r r r r r r r r4 r
r
r
r r . s
@r c
C s t � t jt j� t � t jt j� tr2t �t jt� tj tj
fD ]&}z|�� W q> tk
rb Y q>X q>dd� t
�� D �}z�t| d���}|D ]�}z�|�� �d��d�\}}}t
�|d �} | d kr�td|� d |� ���|d
kr�|| �|� n2|dk�r|| �|� n|dk�rntd
| ��W q� tk
�rT ztjt�� � W n Y nX Y q�X q�W 5 Q R X W 5 |�� D ]�\}}|�r�zt�dt|�|f � W n tk
�r� Y nX |D ]V}zLzt
| |� W n6 tk
�r� } zt�d||f � W 5 d }~X Y nX W 5 X �q��qnX d S )Nc S s i | ]}|t � �qS r
)�set)�.0r7 r
r
r �
<dictcomp>� s zmain.<locals>.<dictcomp>zQresource_tracker: There appear to be %d leaked %s objects to clean up at shutdownzresource_tracker: %r: %s�rbr9 �:zCannot register z. for automatic cleanup: unknown resource type r2 r8 ZPROBEzunrecognized command %r)r'