Your IP : 3.140.195.8


Current Path : /opt/alt/python312/lib64/python3.12/multiprocessing/__pycache__/
Upload File :
Current File : //opt/alt/python312/lib64/python3.12/multiprocessing/__pycache__/resource_tracker.cpython-312.pyc

�

�Q�f\(����ddlZddlZddlZddlZddlZddlmZddlmZgd�Ze	ed�Z
ejejfZ
dd�iZejd	k(rKddlZddlZe	ed
�rej%dej&i�ej%dej(i�Gd
�de�ZGd�de�Ze�Zej4Zej6Zej8Zej:Zd�Zy)�N�)�spawn)�util)�ensure_running�register�
unregister�pthread_sigmask�noopc��y�N�r
��G/opt/alt/python312/lib64/python3.12/multiprocessing/resource_tracker.py�<lambda>r!s��Dr�posix�
sem_unlink�	semaphore�
shared_memoryc��eZdZy)�ReentrantCallErrorN)�__name__�
__module__�__qualname__r
rrrr6s��rrc�B�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zy
)�ResourceTrackerc�R�tj�|_d|_d|_yr)�	threading�RLock�_lock�_fd�_pid��selfs r�__init__zResourceTracker.__init__<s���_�_�&��
������	rc��td��)Nz8Reentrant call into the multiprocessing resource tracker)rr"s r�_reentrant_call_errorz%ResourceTracker._reentrant_call_errorAs��
!�F�H�	Hrc�x�|j5|jj�dkDr|j�cddd�S|j�
	ddd�yt	j
|j�d|_t	j|jd�d|_ddd�y#1swYyxYw)Nrr)r�_recursion_countr&r �os�close�waitpidr!r"s r�_stopzResourceTracker._stopIs���
�Z�Z��z�z�*�*�,�q�0��1�1�3�		�	�
�x�x���	�	�
�H�H�T�X�X���D�H��J�J�t�y�y�!�$��D�I��Z�Z�s�-B0�
B0�A
B0�0B9c�:�|j�|jSr)rr r"s r�getfdzResourceTracker.getfdZs�������x�x�rc�D�|j5|jj�dkDr|j�cddd�S|j��|j	�r
	ddd�ytj|j�	|j� tj|jd�d|_d|_tjd�g}	|jtjj��d}tj"�\}}	|j|�t%j&�}|gt)j*�z}|d||zgz
}	t,r(t/j0t.j2t4�t)j6|||�}t,r)t/j0t.j8t4�	||_||_	tj|�	ddd�y#t$rY��cwxYw#t $rY�� wxYw#t,r)t/j0t.j8t4�wwxYw#tj|��xYw#tj|�wxYw#1swYyxYw)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.rNrzUresource_tracker: process died unexpectedly, relaunching.  Some resources might leak.z:from multiprocessing.resource_tracker import main;main(%d)z-c)rr(r&r �_check_aliver)r*r!r+�ChildProcessError�warnings�warn�append�sys�stderr�fileno�	Exception�piper�get_executabler�_args_from_interpreter_flags�
_HAVE_SIGMASK�signalr	�	SIG_BLOCK�_IGNORED_SIGNALS�spawnv_passfds�SIG_UNBLOCK)r#�fds_to_pass�cmd�r�w�exe�args�pids        rrzResourceTracker.ensure_running^s��
�Z�Z��z�z�*�*�,�q�0��1�1�3�<	�<	��x�x�#��$�$�&��<	�<	�������"���y�y�,��
�
�4�9�9�a�0� ��� ��	��
�
�I�J��K�
��"�"�3�:�:�#4�#4�#6�7�O�C��7�7�9�D�A�q�
��"�"�1�%��*�*�,���u�t�@�@�B�B����s�Q�w��'��U�$��.�.�v�/?�/?�AQ�R��-�-�c�4��E�C�$��.�.�v�/A�/A�CS�T�
�����	������y�Z��$)������
��
��*%��.�.�v�/A�/A�CS�T�%��
��������
������y�Z�s��-J�J�*J�
,H
�6%J�-H�	J�#AI!�+AH-�0/I!�I<�.J�
	H�J�H�J�	H*�&J�)H*�*J�-1I�I!�!I9�9I<�<J�J�Jc�d�	tj|jd�y#t$rYywxYw)z;Check that the pipe has not been closed by sending a probe.s
PROBE:0:noop
TF)r)�writer �OSErrorr"s rr0zResourceTracker._check_alive�s5��	�
�H�H�T�X�X�0�1����	��	�s� #�	/�/c�*�|jd||�y)z0Register name of resource with resource tracker.�REGISTERN��_send�r#�name�rtypes   rrzResourceTracker.register�s���
�
�:�t�U�+rc�*�|jd||�y)z2Unregister name of resource with resource tracker.�
UNREGISTERNrNrPs   rrzResourceTracker.unregister�s���
�
�<��u�-rc��	|j�dj	|||�jd�}t
|�dkDrtd��tj|j|�}|t
|�k(s Jdj	|t
|����y#t$rtjd|�d|�d��Y��wxYw)	NzSResourceTracker called reentrantly for resource cleanup, which is unsupported. The z object z might leak.z{0}:{1}:{2}
�asciiizmsg too longznbytes {0:n} but len(msg) {1:n})rrr2r3�format�encode�len�
ValueErrorr)rJr )r#rCrQrR�msg�nbytess      rrOzResourceTracker._send�s���
	<����!��$�$�S�$��6�=�=�g�F���s�8�c�>��^�,�,����$�(�(�C�(����S��!�	�#D�#K�#K��C��H�$�	�!��"�	<�

�M�M���g�X�d�X�\�;�
<�	<�s�B�%C�CN)rrrr$r&r,r.rr0rrrOr
rrrr:s2���
H��"�A�F	�,�.�rrc��tjtjtj�tjtjtj�tr(tj
tjt�tjtjfD]}	|j��tj�D�cic]
}|t���}}	t!|d�5}|D]�}	|j#�j%d�j'd�\}}}tj)|d�}|�t+d|�d|����|dk(r||j-|�n.|dk(r||j/|�n|d	k(rnt1d
|z����	ddd�|j7�D]B\}}|r$	t9j:dt=|�|fz�|D]}		t||���Dy#t$rY��dwxYwcc}w#t$r1	tj2tj4��n#YnxYwY��VwxYw#1swY��xYw#t$rY��wxYw#t$r%}	t9j:d|�d
|	���Yd}	~	��d}	~	wwxYw#wxYw#|j7�D]�\}}|r4	t9j:dt=|�|fz�n#t$rYnwxYw|D]I}		t||�n1#t$r%}	t9j:d|�d
|	���Yd}	~	nd}	~	wwxYw�F#wxYw��wxYw)zRun resource tracker.�rbrV�:NzCannot register z. for automatic cleanup: unknown resource type rMrT�PROBEzunrecognized command %rzQresource_tracker: There appear to be %d leaked %s objects to clean up at shutdownzresource_tracker: z: )r=�SIGINT�SIG_IGN�SIGTERMr<r	rAr?r5�stdin�stdoutr*r8�_CLEANUP_FUNCS�keys�set�open�strip�decode�split�getrZ�add�remove�RuntimeError�
excepthook�exc_info�itemsr2r3rY)
�fd�frR�cache�linerCrQ�cleanup_func�rtype_cache�es
          r�mainr{�s���M�M�&�-�-����0�
�M�M�&�.�.�&�.�.�1�����v�1�1�3C�D��i�i����
$��	�
�G�G�I�%�(6�':�':�'<�=�'<�e�U�C�E�\�'<�E�=�-�
�"�d�^�q����'+�z�z�|�':�':�7�'C�'I�'I�#�'N�$�C��u�#1�#5�#5�e�T�#B�L�#�+�(�.�t�f�55�5:�G�=�>�>��j�(��e��(�(��.���,��e��+�+�D�1�����*�+D�s�+J�K�K��!��2#(�+�+�-��E�;����M�M�#N�#&�{�#3�U�";�#<�=�
$���N�&�u�-�d�3��$�#0��?�	��	��
>��*!����������7�����	��%�^��>!�����%�N� �
�
�D�!�&L�M�M��N����%#(�+�+�-��E�;����M�M�#N�#&�{�#3�U�";�#<�=��!�����#���N�&�u�-�d�3��$�N� �
�
�D�!�&L�M�M��N����D��$�#0�s�7H�H�4J.�I�B#H �*I�-J.�#I)�8I8�	H�H� 	I�*$I�I�I	�I�I�I�I�I&�"J.�)	I5�4I5�8	J&�J!�J)�!J&�&J)�)J+�.M�#K,�+M�,	K8	�5M�7K8	�8M�L�M�	L?�L:�5M�:L?�?M�M�M�M)r)r=r5rr2�rr�__all__�hasattrr<rarcr?rfrQ�_multiprocessing�_posixshmem�updater�
shm_unlinkrpr�objectr�_resource_trackerrrrr.r{r
rr�<module>r�s��$
�
�
�����
6���� 1�2�
��M�M�6�>�>�2���L����7�7�g�������.�����)�4�4�
�	������/�/���
	��	�M�f�M�`$�%��"�1�1���%�%��
�
)�
)�
�����<r

?>