AlkantarClanX12
Current Path : /opt/alt/python35/lib64/python3.5/multiprocessing/__pycache__/ |
Current File : //opt/alt/python35/lib64/python3.5/multiprocessing/__pycache__/resource_sharer.cpython-35.opt-1.pyc |
��Yf� � @ s� d d l Z d d l Z d d l Z d d l Z d d l Z d d l m Z d d l m Z d d l m Z d g Z e j d k r� e d g 7Z Gd d � d e � Z n# e d g 7Z Gd d � d e � Z Gd d � d e � Z e � Z e j Z d S)� N� )�process)� reduction)�util�stop�win32� DupSocketc @ s. e Z d Z d Z d d � Z d d � Z d S)r zPicklable wrapper for a socket.c s: | j � � � f d d � } t j | � j � | _ d S)Nc s � j | � } | j | � d S)N)�shareZ send_bytes)�conn�pidr )�new_sock� �D/opt/alt/python35/lib64/python3.5/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 s9 t j | j � � } | j � } t j | � SWd QRXd S)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 Z d Z d Z d d � Z d d � Z d S)r z-Wrapper for fd which can be used at any time.c sL t j | � � � f d d � } � f d d � } t j | | � | _ d S)Nc s t j | � | � d S)N)r Zsend_handle)r r )�new_fdr r r 1 s zDupFd.__init__.<locals>.sendc s t j � � d S)N)�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 | j � � } t j | � SWd QRXd S)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.detachN)r r r r r r r r r r r - s c @ ss e Z d Z d Z d d � Z d d � Z e d d � � Z d d d � Z d d � Z d d � Z d d � Z d S)�_ResourceSharerz-Manager for resouces using background thread.c C s\ d | _ i | _ g | _ t j � | _ d | _ d | _ d | _ t j | t j � d S)Nr ) �_key�_cache� _old_locks� threading�Lock�_lock� _listener�_address�_threadr Zregister_after_forkr"