%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/lib/python3.12/multiprocessing/__pycache__/
Upload File :
Create Path :
Current File : //usr/lib/python3.12/multiprocessing/__pycache__/resource_sharer.cpython-312.pyc

�

���f���ddlZddlZddlZddlZddlZddlmZddlmZddlm	Z	dgZ
ejdk(re
dgz
Z
Gd	�de�Z
ne
d
gz
Z
Gd�d
e�ZGd�d
e�Ze�Zej"Zy)�N�)�process)�	reduction)�util�stop�win32�	DupSocketc��eZdZdZd�Zd�Zy)r	zPicklable wrapper for a socket.c�z��|j���fd�}tj|�j�|_y)Nc�J���j|�}|j|�y�N)�share�
send_bytes)�conn�pidr�new_socks   ��6/usr/lib/python3.12/multiprocessing/resource_sharer.py�sendz DupSocket.__init__.<locals>.sends��� ���s�+������&�)�dup�_resource_sharer�register�close�_id)�self�sockrrs   @r�__init__zDupSocket.__init__s-����x�x�z�H�
'�(�0�0��x�~�~�F�D�Hrc��tj|j�5}|j�}t	j
|�cddd�S#1swYyxYw)z1Get the socket.  This should only be called once.N)r�get_connectionr�
recv_bytes�socket�	fromshare)rrrs   r�detachzDupSocket.detach$sE��!�0�0����:�
/�d����)���'�'��.�
/�
/�
/�s�%A�AN��__name__�
__module__�__qualname__�__doc__rr#�rrr	r	s��-�	G�	/r�DupFdc��eZdZdZd�Zd�Zy)r*z-Wrapper for fd which can be used at any time.c�z��tj|���fd�}�fd�}tj||�|_y)Nc�4��tj|�|�yr
)r�send_handle)rr�new_fds  �rrzDupFd.__init__.<locals>.send1s����%�%�d�F�C�8rc�0��tj��yr
)�osr)r/s�rrzDupFd.__init__.<locals>.close3s������� r)r1rrrr)r�fdrrr/s    @rrzDupFd.__init__/s.����V�V�B�Z�F�
9�
!�'�0�0��u�=�D�Hrc��tj|j�5}tj|�cddd�S#1swYyxYw)z-Get the fd.  This should only be called once.N)rrrr�recv_handle)rrs  rr#zDupFd.detach7s9��!�0�0����:�
3�d� �,�,�T�2�
3�
3�
3�s	�?�ANr$r)rrr*r*-s��;�	>�	3rc�F�eZdZdZd�Zd�Zed��Zd
d�Zd�Z	d�Z
d	�Zy)�_ResourceSharerz.Manager for resources using background thread.c���d|_i|_tj�|_d|_d|_d|_tj|tj�y)Nr)�_key�_cache�	threading�Lock�_lock�	_listener�_address�_threadr�register_after_forkr6�
_afterfork)rs rrz_ResourceSharer.__init__?sI����	�����^�^�%��
������
����� � ���'A�'A�Brc��|j5|j�|j�|xjdz
c_||f|j|j<|j|jfcddd�S#1swYyxYw)z+Register resource, returning an identifier.Nr)r<r>�_startr8r9)rrrs   rrz_ResourceSharer.registerHsd��
�Z�Z�	.��}�}�$����
��I�I��N�I�&*�E�]�D�K�K��	�	�"��M�M�4�9�9�-�	.�	.�	.�s�A$A;�;Bc��ddlm}|\}}||tj�j��}|j|t
j�f�|S)z<Return connection from which to receive identified resource.r��Client��authkey)�
connectionrFr�current_processrHrr1�getpid)�identrF�address�key�cs     rrz_ResourceSharer.get_connectionQsG��	'������7�G�$;�$;�$=�$E�$E�F��	����R�Y�Y�[�!�"��rNc��ddlm}|j5|j��||jt	j
�j��}|jd�|j�|jj|�|jj�rtjd�|jj�d|_	d|_d|_|jj!�D]\}\}}|��|jj#�ddd�y#1swYyxYw)z:Stop the background thread and clear registered resources.rrENrGz._ResourceSharer thread did not stop when asked)rIrFr<r>rrJrHrrr?�join�is_aliver�sub_warningr=r9�items�clear)r�timeoutrFrOrNrrs       rrz_ResourceSharer.stopZs���&�
�Z�Z�	$��}�}�(��4�=�=�#*�#:�#:�#<�#D�#D�F�����t�����	����!�!�'�*��<�<�(�(�*��$�$�&;�<����$�$�&�#��� $��
�!%���*.�+�+�*;�*;�*=��&�C��$���G�����!�!�#�!	$�	$�	$�s�DD:�:Ec�:�|jj�D]\}\}}|��|jj�|jj	�|j
�|j
j
�d|_d|_d|_yr
)	r9rTrUr<�_at_fork_reinitr=rr>r?)rrNrrs    rrAz_ResourceSharer._afterforkos{��"&�+�+�"3�"3�"5�	��C��$���G�	��������
�
�"�"�$��>�>�%��N�N� � �"������
���rc�h�ddlm}|j�Jd��tjd�|tj�jd��|_|jj|_	tj|j��}d|_
|j�||_y)	Nr)�ListenerzAlready have Listenerz0starting listener and thread for sending handles�)rH�backlog)�targetT)rIrZr=r�debugrrJrHrMr>r:�Thread�_serve�daemon�startr?)rrZ�ts   rrCz_ResourceSharer._startzs���(��~�~�%�>�'>�>�%��
�
�E�F�!�'�*A�*A�*C�*K�*K�UX�Y������.�.��
����D�K�K�0�����	���	���rc�*�ttd�r6tjtjtj��		|j
j
�5}|j�}|�
	ddd�y|\}}|jj|�\}}	|||�|�	ddd��v#|�wxYw#1swY�xYw#tj�s$tjtj��Y�UxYw)N�pthread_sigmask)�hasattr�signalre�	SIG_BLOCK�
valid_signalsr=�accept�recvr9�popr�
is_exiting�sys�
excepthook�exc_info)rr�msgrN�destination_pidrrs       rr`z_ResourceSharer._serve�s����6�,�-��"�"�6�#3�#3�V�5I�5I�5K�L��

4��^�^�*�*�,�	 ���)�)�+�C��{��	 �	 �,/�(�C��"&�+�+�/�/�#�"6�K�D�%� ��T�?�3���	 ������	 �	 ��
4����(��N�N�C�L�L�N�3�sH�	C�#C
�7C�#C
�$	B>�-C
�5C�>	C�C
�
C�C�:Dr
)r%r&r'r(rr�staticmethodrrrArCr`r)rrr6r6=s8��8�C�.�����$�*	�	�4rr6)r1rgr!rnr:�r�contextrr�__all__�platform�objectr	r*r6rrr)rr�<module>rys���
�
�
�
������(���<�<�7����}��G�
/�F�
/� ��y��G�
3��
3� Y4�f�Y4�x#�$�����r

Zerion Mini Shell 1.0