관리-도구
편집 파일: resource_sharer.cpython-311.pyc
� c��f � � � d dl Z d dlZd dlZd dlZd dlZddlmZ ddlmZ ddlm Z dgZ ej dk re dgz Z G d � de� � Z ne d gz Z G d� d e� � Z G d� d e� � Z e� � Zej ZdS )� N� )�process)� reduction)�util�stop�win32� DupSocketc � � e Zd ZdZd� Zd� ZdS )r zPicklable wrapper for a socket.c � �� |� � � ��fd�}t � |�j � � | _ d S )Nc �\ �� �� |� � }| � |� � d S �N)�share� send_bytes)�conn�pidr �new_socks ��F/opt/alt/python311/lib64/python3.11/multiprocessing/resource_sharer.py�sendz DupSocket.__init__.<locals>.send s, �� � ���s�+�+������&�&�&�&�&� )�dup�_resource_sharer�register�close�_id)�self�sockr r s @r �__init__zDupSocket.__init__ sH �� ��x�x�z�z�H� '� '� '� '� '� (�0�0��x�~�F�F�D�H�H�Hr c �� � t � | j � � 5 }|� � � }t j |� � cddd� � S # 1 swxY w Y dS )z1Get the socket. This should only be called once.N)r �get_connectionr � recv_bytes�socket� fromshare)r r r s r �detachzDupSocket.detach$ s� � �!�0�0���:�:� /�d����)�)���'��.�.� /� /� /� /� /� /� /� /� /� /� /� /���� /� /� /� /� /� /s �(A�A�AN��__name__� __module__�__qualname__�__doc__r r# � r r r r s; � � � � � �-�-� G� G� G� /� /� /� /� /r �DupFdc � � e Zd ZdZd� Zd� ZdS )r* z-Wrapper for fd which can be used at any time.c � �� t j |� � ��fd�}�fd�}t � ||� � | _ d S )Nc �4 �� t j | �|� � d S r )r �send_handle)r r �new_fds �r r zDupFd.__init__.<locals>.send1 s �� ��%�d�F�C�8�8�8�8�8r c �0 �� t j � � � d S r )�osr )r/ s �r r zDupFd.__init__.<locals>.close3 s �� ���� � � � � r )r1 r r r r )r �fdr r r/ s @r r zDupFd.__init__/ s] �� ��V�B�Z�Z�F� 9� 9� 9� 9� 9� !� !� !� !� !�'�0�0��u�=�=�D�H�H�Hr c � � t � | j � � 5 }t j |� � cddd� � S # 1 swxY w Y dS )z-Get the fd. This should only be called once.N)r r r r �recv_handle)r r s r r# zDupFd.detach7 s� � �!�0�0���:�:� 3�d� �,�T�2�2� 3� 3� 3� 3� 3� 3� 3� 3� 3� 3� 3� 3���� 3� 3� 3� 3� 3� 3s �A�A�ANr$ r) r r r* r* - s8 � � � � � �;�;� >� >� >� 3� 3� 3� 3� 3r c �N � e Zd ZdZd� Zd� Zed� � � Zd d�Zd� Z d� Z d � ZdS )�_ResourceSharerz.Manager for resources using background thread.c � � d| _ i | _ t j � � | _ d | _ d | _ d | _ t j | t j � � d S )Nr )�_key�_cache� threading�Lock�_lock� _listener�_address�_threadr �register_after_forkr6 � _afterfork)r s r r z_ResourceSharer.__init__? sP � ��� �����^�%�%�� ������ ����� ���'A�B�B�B�B�Br c �� � | j 5 | j �| � � � | xj dz c_ ||f| j | j <