AlkantarClanX12
Current Path : /opt/alt/python35/lib64/python3.5/multiprocessing/__pycache__/ |
Current File : //opt/alt/python35/lib64/python3.5/multiprocessing/__pycache__/forkserver.cpython-35.pyc |
��Yf � @ sd d d l Z d d l Z d d l Z 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 d l m Z d d l m Z d d l m Z d d d d g Z d Z e j d � Z Gd d � d e � Z d d d d � Z d d � Z d d � Z d d � Z e � Z e j Z e j Z e j Z e j Z d S)� N� )� connection)�process)� reduction)�semaphore_tracker)�spawn)�util�ensure_running�get_inherited_fds�connect_to_new_process�set_forkserver_preload� �Qc @ sL e Z d Z d d � Z d d � Z d d � Z d d � Z d d � Z d S)� ForkServerc C s: d | _ d | _ d | _ t j � | _ d g | _ d S)N�__main__)�_forkserver_address�_forkserver_alive_fd�_inherited_fds� threadingZLock�_lock�_preload_modules)�self� r �?/opt/alt/python35/lib64/python3.5/multiprocessing/forkserver.py�__init__! s zForkServer.__init__c C s5 t d d � | j D� � s( t d � � | | _ d S)z>Set list of module names to try to load in forkserver process.c s s! | ] } t | � t k Vq d S)N)�type�str)�.0�modr r r � <genexpr>* s z4ForkServer.set_forkserver_preload.<locals>.<genexpr>z&module_names must be a list of stringsN)�allr � TypeError)r Z modules_namesr r r r ( s z!ForkServer.set_forkserver_preloadc C s | j S)z�Return list of fds inherited from parent process. This returns None if the current process was not started by fork server. )r )r r r r r . s zForkServer.get_inherited_fdsc C s | j � t | � d t k r, t d � � t j t j � �� } | j | j � t j � \ } } t j � \ } } | | | j t j � g } | | 7} zJ y t j | | � | | f SWn% t j | � t j | � � Yn XWd t j | � t j | � XWd QRXd S)a; Request forkserver to create a child process. Returns a pair of fds (status_r, data_w). The calling process can read the child process's pid and (eventually) its returncode from status_r. The calling process should write to data_w the pickled preparation and process data. � ztoo many fdsN)r �len�MAXFDS_TO_SEND� ValueError�socket�AF_UNIXZconnectr �os�piper r Zgetfdr Zsendfds�close)r �fdsZclientZparent_r�child_w�child_rZparent_wZallfdsr r r r 6 s&