Hacked By AnonymousFox

Current Path : /opt/alt/python37/lib64/python3.7/multiprocessing/__pycache__/
Upload File :
Current File : //opt/alt/python37/lib64/python3.7/multiprocessing/__pycache__/semaphore_tracker.cpython-37.opt-2.pyc

B

YI~d[�@s�ddlZddlZddlZddlZddlZddlZddlmZddlmZdddgZ	Gdd	�d	e
�Ze�Zej
Z
ejZejZejZd
d�ZdS)�N�)�spawn)�util�ensure_running�register�
unregisterc@s<eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
S)�SemaphoreTrackercCst��|_d|_d|_dS)N)�	threadingZLock�_lock�_fd�_pid)�self�r�F/opt/alt/python37/lib64/python3.7/multiprocessing/semaphore_tracker.py�__init__s
zSemaphoreTracker.__init__cCs|��|jS)N)rr)r
rrr�getfd"szSemaphoreTracker.getfdc	
Cs|j��|jdk	rRt�|jtj�\}}|s0dSt�|j�d|_d|_t�d�g}y|�	t
j���Wnt
k
r~YnXd}t��\}}zlyB|�	|�t��}|gt��}|d||g7}t�|||�}Wnt�|��YnX||_||_Wdt�|�XWdQRXdS)NzWsemaphore_tracker: process died unexpectedly, relaunching.  Some semaphores might leak.z;from multiprocessing.semaphore_tracker import main;main(%d)z-c)r
r�os�waitpid�WNOHANG�closer�warnings�warn�append�sys�stderr�fileno�	Exception�piperZget_executablerZ_args_from_interpreter_flagsZspawnv_passfds)	r
�pid�statusZfds_to_pass�cmd�r�wZexe�argsrrrr&s8





zSemaphoreTracker.ensure_runningcCs|�d|�dS)NZREGISTER)�_send)r
�namerrrrQszSemaphoreTracker.registercCs|�d|�dS)NZ
UNREGISTER)r$)r
r%rrrrUszSemaphoreTracker.unregistercCs@|��d�||��d�}t|�dkr.td��t�|j|�}dS)Nz{0}:{1}
�asciiiz
name too long)r�format�encode�len�
ValueErrorr�writer)r
r r%�msg�nbytesrrrr$YszSemaphoreTracker._sendN)	�__name__�
__module__�__qualname__rrrrrr$rrrrrs+rcCs�t�tjtj�t�tjtj�x6tjtjfD]&}y|��Wq.tk
rRYq.Xq.Wt	�}z�t
|d���}x�|D]�}yJ|���d�\}}|dkr�|�
|�n |dkr�|�|�ntd|��Wqrtk
r�ytjt���WnYnXYqrXqrWWdQRXWd|�r<yt�dt|��Wntk
�r:YnXxf|D]^}zT|�d�}yt�|�Wn6tk
�r�}zt�d||f�Wdd}~XYnXWdX�qBWXdS)	N�rb�:sREGISTERs
UNREGISTERzunrecognized command %rzRsemaphore_tracker: There appear to be %d leaked semaphores to clean up at shutdownr&zsemaphore_tracker: %r: %s)�signal�SIGINT�SIG_IGN�SIGTERMr�stdin�stdoutrr�set�open�strip�split�add�remove�RuntimeError�
excepthook�exc_inforrr)�decode�_multiprocessingZ
sem_unlink)�fd�f�cache�liner r%�errr�mainlsJ



(rI)rr3rr	rrC�rr�__all__�objectrZ_semaphore_trackerrrrrrIrrrr�<module>s
J

Hacked By AnonymousFox1.0, Coded By AnonymousFox