;
Σβ"Ic               @   s
  g  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	 m
 Z
 m Z m Z d  d l m Z m Z m Z d  d l m Z m Z e j d k p e e d  p e d   n e j d k o2 d  d l Z d	 d
 l m Z d   Z d   Z n d   Z d   Z e   a d   Z e d  e e e  d   Z d   Z  d   Z! d   Z" d   Z# d   Z$ e j% e j& e#  d  d  Z' d   Z( d   Z) e j% e j e(  e j d k o) d   Z* d   Z+ e j% e j, e*  n d S(   i    N(   u   current_process(   u   Popenu	   duplicateu   closeu   ForkingPickler(   u   register_after_forku   debugu	   sub_debug(   u   Clientu   Listeneru   win32u   recvfdu%   pickling of connections not supportedi   (   u   win32c          	   C   sJ   t  j t  j d |  } z  t | |  } |  j |  Wd  t |  Xd  S(   NF(   u   win32u   OpenProcessu   PROCESS_ALL_ACCESSu   Falseu	   duplicateu   sendu   close(   u   connu   handleu   destination_pidu   process_handleu
   new_handle(    (    u6   /mit/python/lib/python3.0/multiprocessing/reduction.pyu   send_handle'   s    c             C   s
   |  j    S(   N(   u   recv(   u   conn(    (    u6   /mit/python/lib/python3.0/multiprocessing/reduction.pyu   recv_handle1   s    c             C   s   t  j |  j   |  d  S(   N(   u   _multiprocessingu   sendfdu   fileno(   u   connu   handleu   destination_pid(    (    u6   /mit/python/lib/python3.0/multiprocessing/reduction.pyu   send_handle5   s    c             C   s   t  j |  j    S(   N(   u   _multiprocessingu   recvfdu   fileno(   u   conn(    (    u6   /mit/python/lib/python3.0/multiprocessing/reduction.pyu   recv_handle8   s    c             C   s;   x t  D] } t |  q Wt  j   t j   a d  a d  S(   N(   u   _cacheu   closeu   clearu	   threadingu   Locku   _locku   Noneu	   _listener(   u   obju   h(    (    u6   /mit/python/lib/python3.0/multiprocessing/reduction.pyu   _resetA   s     
c           	   C   s   t  d  k ou t j   zY t  d  k oH t d  t d t   j  a  t j	 d t
  }  d |  _ |  j   n Wd  t j   Xn t  S(   Nu0   starting listener and thread for sending handlesu   authkeyu   targetT(   u	   _listeneru   Noneu   _locku   acquireu   debugu   Listeneru   current_processu   authkeyu	   threadingu   Threadu   _serveu   Trueu   daemonu   startu   release(   u   t(    (    u6   /mit/python/lib/python3.0/multiprocessing/reduction.pyu   _get_listenerL   s    

	c              C   sΐ   d d l  m }  m } x£ yS t j   } | j   \ } } t j |  t | | |  t	 |  | j	   Wq |    p8 d d  l
 } | d d d d | j   d d  n Yq Xq d  S(   Ni   (   u
   is_exitingu   sub_warningi    u.   thread for sharing handles raised exception :
u   -iO   u   
(   u   utilu
   is_exitingu   sub_warningu	   _listeneru   acceptu   recvu   _cacheu   removeu   send_handleu   closeu	   tracebacku
   format_exc(   u
   is_exitingu   sub_warningu   connu   handle_wantedu   destination_pidu	   traceback(    (    u6   /mit/python/lib/python3.0/multiprocessing/reduction.pyu   _serve]   s    

c             C   s]   t  j   o d  t  j |   d f St |   } t j |  t d |   t	   j
 | d f S(   Nu   reducing handle %dTF(   u   Popenu   thread_is_spawningu   Noneu   duplicate_for_childu   Trueu	   duplicateu   _cacheu   addu	   sub_debugu   _get_listeneru   addressu   False(   u   handleu
   dup_handle(    (    u6   /mit/python/lib/python3.0/multiprocessing/reduction.pyu   reduce_handlet   s    c             C   ss   |  \ } } } | o | St  d |  t | d t   j } | j | t j   f  t |  } | j   | S(   Nu   rebuilding handle %du   authkey(	   u	   sub_debugu   Clientu   current_processu   authkeyu   sendu   osu   getpidu   recv_handleu   close(   u   pickled_datau   addressu   handleu	   inheritedu   connu
   new_handle(    (    u6   /mit/python/lib/python3.0/multiprocessing/reduction.pyu   rebuild_handle|   s    
c             C   s+   t  |  j    } t | |  j |  j f f S(   N(   u   reduce_handleu   filenou   rebuild_connectionu   readableu   writable(   u   connu   rh(    (    u6   /mit/python/lib/python3.0/multiprocessing/reduction.pyu   reduce_connection   s    c             C   s%   t  |   } t j | d | d | S(   Nu   readableu   writable(   u   rebuild_handleu   _multiprocessingu
   Connection(   u   reduced_handleu   readableu   writableu   handle(    (    u6   /mit/python/lib/python3.0/multiprocessing/reduction.pyu   rebuild_connection   s    c             C   sE   t  j |  | | |  } | j t  j  k	 o t  j  d |  } n | S(   Nu   _sock(   u   socketu   fromfdu	   __class__(   u   fdu   familyu   type_u   protou   s(    (    u6   /mit/python/lib/python3.0/multiprocessing/reduction.pyu   fromfd   s    c             C   s1   t  |  j    } t | |  j |  j |  j f f S(   N(   u   reduce_handleu   filenou   rebuild_socketu   familyu   typeu   proto(   u   su   reduced_handle(    (    u6   /mit/python/lib/python3.0/multiprocessing/reduction.pyu   reduce_socket‘   s    c             C   s/   t  |   } t | | | |  } t |  | S(   N(   u   rebuild_handleu   fromfdu   close(   u   reduced_handleu   familyu   type_u   protou   fdu   _sock(    (    u6   /mit/python/lib/python3.0/multiprocessing/reduction.pyu   rebuild_socket₯   s    
c             C   s+   t  |  j    } t | |  j |  j f f S(   N(   u   reduce_handleu   filenou   rebuild_pipe_connectionu   readableu   writable(   u   connu   rh(    (    u6   /mit/python/lib/python3.0/multiprocessing/reduction.pyu   reduce_pipe_connection³   s    c             C   s%   t  |   } t j | d | d | S(   Nu   readableu   writable(   u   rebuild_handleu   _multiprocessingu   PipeConnection(   u   reduced_handleu   readableu   writableu   handle(    (    u6   /mit/python/lib/python3.0/multiprocessing/reduction.pyu   rebuild_pipe_connection·   s    (-   u   __all__u   osu   sysu   socketu	   threadingu   _multiprocessingu   multiprocessingu   current_processu   multiprocessing.forkingu   Popenu	   duplicateu   closeu   ForkingPickleru   multiprocessing.utilu   register_after_forku   debugu	   sub_debugu   multiprocessing.connectionu   Clientu   Listeneru   platformu   hasattru   ImportErroru   _subprocessu   win32u   send_handleu   recv_handleu   setu   _cacheu   _resetu   Noneu   _get_listeneru   _serveu   reduce_handleu   rebuild_handleu   reduce_connectionu   rebuild_connectionu   registeru
   Connectionu   fromfdu   reduce_socketu   rebuild_socketu   reduce_pipe_connectionu   rebuild_pipe_connectionu   PipeConnection(    (    (    u6   /mit/python/lib/python3.0/multiprocessing/reduction.pyu   <module>
   sJ   " 	
				
										