AlkantarClanX12
Current Path : /opt/alt/python39/lib64/python3.9/multiprocessing/__pycache__/ |
Current File : //opt/alt/python39/lib64/python3.9/multiprocessing/__pycache__/resource_sharer.cpython-39.opt-1.pyc |
a R�f � @ s� d dl Z d dlZd dlZd dlZd dlZddlmZ ddlmZ ddlm Z dgZ ejdkrxe dg7 Z G d d� de�Z ne d g7 Z G dd � d e�ZG dd � d e�Ze� ZejZdS )� N� )�process)� reduction)�util�stopZwin32� DupSocketc @ s e Zd ZdZdd� Zdd� ZdS )r zPicklable wrapper for a socket.c s( |� � � � fdd�}t�|� j�| _d S )Nc s � � |�}| �|� d S �N)�shareZ send_bytes)�conn�pidr �Znew_sock� �D/opt/alt/python39/lib64/python3.9/multiprocessing/resource_sharer.py�send s z DupSocket.__init__.<locals>.send)�dup�_resource_sharer�register�close�_id)�selfZsockr r r r �__init__ s zDupSocket.__init__c C sB t �| j��"}|�� }t�|�W d � S 1 s40 Y dS )z1Get the socket. This should only be called once.N)r �get_connectionr Z recv_bytes�socketZ fromshare)r r r r r r �detach$ s zDupSocket.detachN��__name__� __module__�__qualname__�__doc__r r r r r r r s �DupFdc @ s e Zd ZdZdd� Zdd� ZdS )r z-Wrapper for fd which can be used at any time.c s4 t �|�� � fdd�}� fdd�}t�||�| _d S )Nc s t �| � |� d S r )r Zsend_handle)r r �Znew_fdr r r 1 s zDupFd.__init__.<locals>.sendc s t �� � d S r )�osr r r r r r 3 s zDupFd.__init__.<locals>.close)r! r r r r )r �fdr r r r r r / s zDupFd.__init__c C s: t �| j��}t�|�W d � S 1 s,0 Y dS )z-Get the fd. This should only be called once.N)r r r r Zrecv_handle)r r r r r r 7 s zDupFd.detachNr r r r r r - s c @ sN e Zd ZdZdd� Zdd� Zedd� �Zdd d �Zdd� Z d d� Z dd� ZdS )�_ResourceSharerz.Manager for resources using background thread.c C s: d| _ i | _t�� | _d | _d | _d | _t� | t j� d S )Nr )�_key�_cache� threadingZLock�_lock� _listener�_address�_threadr Zregister_after_forkr# � _afterfork)r r r r r ? s z_ResourceSharer.__init__c C sf | j �L | jdu r| �� | jd7 _||f| j| j<