관리-도구
편집 파일: forkserver.cpython-34.pyc
� e f! � @ 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/python34/lib64/python3.4/multiprocessing/forkserver.py�__init__! s zForkServer.__init__c C s8 t d d � | j D� � s+ t d � � n | | _ 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 � � n 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 QXd 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&