Ñò
˜à"Ic           @   s  d  d k  Z  d  d k Z d  d k Z d  d k l Z l Z d d d d d d g Z d	 „  Z d  d
 k l	 Z	 d e	 f d „  ƒ  YZ
 d „  Z e
 i e e
 i ƒ e ƒ d „  Z e
 i e e i ƒ e ƒ e
 i e e i ƒ e ƒ y d  d k l Z Wn e j
 o n$ Xd „  Z d „  Z e
 i e e ƒ e i d j oA d  d k Z e  i Z e  i Z e  i Z d e  f d „  ƒ  YZ! n{d  d k" Z" d  d k# Z# d  d k$ Z$ d  d k Z d d k% l& Z& l' Z' l( Z( d d k l) Z) d  d k l* Z* l+ Z+ d d „ Z- d Z. e i d j o e/ e d e0 ƒ Z1 e& i2 Z e& i3 Z e i4 i5 ƒ  i6 d ƒ o e  i7 i8 e i9 d ƒ a: n
 e i4 a: d „  Z; d e0 d „ Z d e  f d „  ƒ  YZ! d „  Z< d  „  Z= d! „  Z> d" „  Z? d# „  Z@ d$ „  ZA e
 i e' eA ƒ e
 i e( eA ƒ g  ZB d% „  ZC d S(&   iÿÿÿÿN(   t   utilt   processt   Popent   assert_spawningt   exitt	   duplicatet   closet   ForkingPicklerc         C   s.   t  i ƒ  p t d t |  ƒ i ƒ ‚ n d  S(   NsF   %s objects should only be shared between processes through inheritance(   R   t   thread_is_spawningt   RuntimeErrort   typet   __name__(   t   self(    (    s4   /mit/python/lib/python2.6/multiprocessing/forking.pyR      s    (   t   Picklerc           B   s&   e  Z e i i ƒ  Z e d  „  ƒ Z RS(   c            s    ‡  f d †  } | |  i  | <d  S(   Nc            s#   ˆ  | ƒ } |  i  d | | Œ d  S(   Nt   obj(   t   save_reduce(   R   R   t   rv(   t   reduce(    s4   /mit/python/lib/python2.6/multiprocessing/forking.pyt
   dispatcher&   s    (   t   dispatch(   t   clsR
   R   R   (    (   R   s4   /mit/python/lib/python2.6/multiprocessing/forking.pyt   register$   s    (   R   t
   __module__R   R   t   copyt   classmethodR   (    (    (    s4   /mit/python/lib/python2.6/multiprocessing/forking.pyR   !   s   c         C   sG   |  i  d  j o t |  i |  i i f f St |  i  |  i i f f Sd  S(   N(   t   im_selft   Nonet   getattrt   im_classt   im_funct	   func_name(   t   m(    (    s4   /mit/python/lib/python2.6/multiprocessing/forking.pyt   _reduce_method+   s    c         C   s   t  |  i |  i f f S(   N(   R   t   __objclass__R   (   R   (    (    s4   /mit/python/lib/python2.6/multiprocessing/forking.pyt   _reduce_method_descriptor2   s    (   t   partialc         C   s#   t  |  i |  i |  i p h  f f S(   N(   t   _rebuild_partialt   funct   argst   keywords(   t   p(    (    s4   /mit/python/lib/python2.6/multiprocessing/forking.pyt   _reduce_partialA   s    c         C   s   t  |  | | Ž S(   N(   R#   (   R%   R&   R'   (    (    s4   /mit/python/lib/python2.6/multiprocessing/forking.pyR$   C   s    t   win32c           B   sD   e  Z d  „  Z e i d „ Z d d „ Z d „  Z e	 d „  ƒ Z
 RS(   c         C   s§   t  i i ƒ  t  i i ƒ  d  |  _ t i ƒ  |  _ |  i d j oa d t  i	 j o d d  k
 } | i ƒ  n | i ƒ  } t  i i ƒ  t  i i ƒ  t i | ƒ n d  S(   Ni    t   randomiÿÿÿÿ(   t   syst   stdoutt   flusht   stderrR   t
   returncodet   ost   forkt   pidt   modulesR+   t   seedt
   _bootstrapt   _exit(   R   t   process_objR+   t   code(    (    s4   /mit/python/lib/python2.6/multiprocessing/forking.pyt   __init__Y   s    	c         C   sƒ   |  i  d  j ol t i |  i | ƒ \ } } | |  i j o= t i | ƒ o t i | ƒ |  _  qx t i | ƒ |  _  q| n |  i  S(   N(   R0   R   R1   t   waitpidR3   t   WIFSIGNALEDt   WTERMSIGt   WEXITSTATUS(   R   t   flagR3   t   sts(    (    s4   /mit/python/lib/python2.6/multiprocessing/forking.pyt   pollh   s    c         C   sž   | d  j o |  i d ƒ St i ƒ  | } d } xf |  i ƒ  } | d  j	 o Pn | t i ƒ  } | d j o Pn t | d | d ƒ } t i | ƒ q4 | S(   Ni    gü©ñÒMb@?i   gš™™™™™©?(   R   RA   t   timet   mint   sleep(   R   t   timeoutt   deadlinet   delayt   rest	   remaining(    (    s4   /mit/python/lib/python2.6/multiprocessing/forking.pyt   waits   s    c         C   sj   |  i  d  j oV y t i |  i t i ƒ Wqf t j
 o) } |  i d d ƒ d  j o ‚  qb qf Xn d  S(   NRE   gš™™™™™¹?(	   R0   R   R1   t   killR3   t   signalt   SIGTERMt   OSErrorRJ   (   R   t   e(    (    s4   /mit/python/lib/python2.6/multiprocessing/forking.pyt	   terminateƒ   s    c           C   s   t  S(   N(   t   False(    (    (    s4   /mit/python/lib/python2.6/multiprocessing/forking.pyR   ‹   s    N(   R   R   R:   R1   t   WNOHANGRA   R   RJ   RP   t   staticmethodR   (    (    (    s4   /mit/python/lib/python2.6/multiprocessing/forking.pyR   W   s
   		i   (   R*   t
   Connectiont   PipeConnection(   t   Finalize(   t   loadt   HIGHEST_PROTOCOLc         C   s   t  | | ƒ i |  ƒ d  S(   N(   R   t   dump(   R   t   filet   protocol(    (    s4   /mit/python/lib/python2.6/multiprocessing/forking.pyRY   ¡   s    i   t   frozens   pythonservice.exes
   python.exec         C   s
   |  a  d  S(   N(   t   _python_exe(   t   exe(    (    s4   /mit/python/lib/python2.6/multiprocessing/forking.pyt   set_executable¸   s    c         C   sH   | d  j o t i ƒ  } n t i t i ƒ  |  | d | t i ƒ i ƒ  S(   Ni    (   R   t   _subprocesst   GetCurrentProcesst   DuplicateHandlet   DUPLICATE_SAME_ACCESSt   Detach(   t   handlet   target_processt   inheritable(    (    s4   /mit/python/lib/python2.6/multiprocessing/forking.pyR   À   s
    c           B   s_   e  Z d  Z e i ƒ  Z d „  Z e d „  ƒ Z e d „  ƒ Z	 d d „ Z d „  Z d „  Z RS(   sH   
        Start a subprocess to run the code of a process object
        c      
   C   s7  t  i ƒ  \ } } t t i | ƒ d t ƒ} t  i | ƒ t ƒ  | g } d i d „  | Dƒ ƒ } t	 i
 t | d  d  d d d  d  d  ƒ	 \ } } } }	 | i ƒ  t | ƒ | |  _ d  |  _ | |  _ t | i ƒ }
 t  i | d ƒ } t | ƒ t i _ z$ t |
 | t ƒ t | | t ƒ Wd  t i ` | i ƒ  Xd  S(   NRg   t    c         s   s   x |  ] } d  | Vq Wd S(   s   "%s"N(    (   t   .0t   x(    (    s4   /mit/python/lib/python2.6/multiprocessing/forking.pys	   <genexpr>Ý   s   	 i   i    t   wb(   R1   t   pipeR   t   msvcrtt   get_osfhandlet   TrueR   t   get_command_linet   joinR`   t   CreateProcessR]   R   t   CloseR3   R0   t   _handlet   get_preparation_datat   _namet   fdopent   intR   t   _tlst   process_handleRY   RX   (   R   R8   t   rfdt   wfdt   rhandlet   cmdt   hpt   htR3   t   tidt	   prep_datat   to_child(    (    s4   /mit/python/lib/python2.6/multiprocessing/forking.pyR:   Ó   s(    -

				c           C   s   t  t i d d  ƒ d  j	 S(   NRz   (   R   R   Ry   R   (    (    (    s4   /mit/python/lib/python2.6/multiprocessing/forking.pyR   ô   s    c         C   s   t  |  t i i ƒ S(   N(   R   R   Ry   Rz   (   Re   (    (    s4   /mit/python/lib/python2.6/multiprocessing/forking.pyt   duplicate_for_childø   s    c         C   s·   |  i  d  j o  | d  j o t i } n t d t | d d ƒ ƒ } t i t |  i ƒ | ƒ } | t i j o: t i	 |  i ƒ } | t
 j o t i } n | |  _  q° n |  i  S(   Ni    iè  g      à?(   R0   R   R`   t   INFINITEt   maxRx   t   WaitForSingleObjectRt   t   WAIT_OBJECT_0t   GetExitCodeProcesst	   TERMINATERL   RM   (   R   RE   t   msecsRH   R9   (    (    s4   /mit/python/lib/python2.6/multiprocessing/forking.pyRJ   ü   s    c         C   s   |  i  d d ƒ S(   NRE   i    (   RJ   (   R   (    (    s4   /mit/python/lib/python2.6/multiprocessing/forking.pyRA     s    c         C   sk   |  i  d  j oW y t i t |  i ƒ t ƒ Wqg t j
 o' |  i d d ƒ d  j o ‚  qc qg Xn d  S(   NRE   gš™™™™™¹?(	   R0   R   R`   t   TerminateProcessRx   Rt   RŠ   t   WindowsErrorRJ   (   R   (    (    s4   /mit/python/lib/python2.6/multiprocessing/forking.pyRP     s    N(   R   R   t   __doc__t   threadt   _localRy   R:   RS   R   R„   R   RJ   RA   RP   (    (    (    s4   /mit/python/lib/python2.6/multiprocessing/forking.pyR   Í   s   	!	c         C   s1   t  |  ƒ d j o |  d d j o t St Sd S(   sE   
        Return whether commandline indicates we are forking
        i   i   s   --multiprocessing-forkN(   t   lenRo   RQ   (   t   argv(    (    s4   /mit/python/lib/python2.6/multiprocessing/forking.pyt
   is_forking  s    $c           C   s)   t  t i ƒ o t ƒ  t i ƒ  n d S(   sM   
        Run code for process object if this in not the main process
        N(   R“   R,   R’   t   mainR   (    (    (    s4   /mit/python/lib/python2.6/multiprocessing/forking.pyt   freeze_support&  s    c          C   sq   t  i ƒ  i d j o  t t i ƒ o t d ƒ ‚ n t t d t ƒ o t i	 d g Sd }  t
 d |  d g Sd S(   sR   
        Returns prefix of command line used for spawning a child process
        s÷  
            Attempt to start a new process before the current process
            has finished its bootstrapping phase.

            This probably means that you are on Windows and you have
            forgotten to use the proper idiom in the main module:

                if __name__ == '__main__':
                    freeze_support()
                    ...

            The "freeze_support()" line can be omitted if the program
            is not going to be frozen to produce a Windows executable.R\   s   --multiprocessing-forks0   from multiprocessing.forking import main; main()s   -cN(    (   R   t   current_processt	   _identityR“   R,   R’   R	   R   RQ   t
   executableR]   (   t   prog(    (    s4   /mit/python/lib/python2.6/multiprocessing/forking.pyRp   /  s    &c          C   sž   t  t i d ƒ }  t i |  t i ƒ } t i | d ƒ } t t	 i
 ƒ  _ t | ƒ } t | ƒ t | ƒ } t t	 i
 ƒ  _ | i ƒ  | i ƒ  } t | ƒ d S(   s>   
        Run code specifed by data received over pipe
        iÿÿÿÿt   rbN(   Rx   R,   R’   Rm   t   open_osfhandleR1   t   O_RDONLYRw   Ro   R   R–   t   _inheritingRW   t   prepareRQ   R   R6   R   (   Re   t   fdt   from_parentt   preparation_dataR   t   exitcode(    (    s4   /mit/python/lib/python2.6/multiprocessing/forking.pyR”   I  s    

c         C   s2  d d k  l } l } t d |  d t i d t i d | d t i d t i	 ƒ  i
 ƒ } | d j	 o | i ƒ  | d	 <n t p± t t i d
 d d ƒ } | o% t i d d j o t i d } n | d j	 oZ t i i | ƒ o, t i d j	 o t i i t i | ƒ } n t i i | ƒ | d <q.n | S(   sU   
        Return info about parent needed by child to unpickle process object
        i   (   t   _loggert   _log_to_stderrt   namet   sys_patht   sys_argvt   log_to_stderrt   orig_dirt   authkeyt	   log_levelt   __main__t   __file__i    t    s   -ct	   main_pathN(   R®   s   -c(   R    R£   R¤   t   dictR,   t   pathR’   R   t   ORIGINAL_DIRR–   Rª   R   t   getEffectiveLevelt   WINEXER   R4   R1   t   isabsRq   t   normpath(   R¥   R£   R¤   t   dR¯   (    (    s4   /mit/python/lib/python2.6/multiprocessing/forking.pyRu   _  s(    			c         C   sX   t  i ƒ  p t d t |  ƒ i ƒ ‚ n t |  ƒ t  i |  i ƒ  ƒ |  i |  i f f S(   NsL   By default %s objects can only be shared between processes
using inheritance(	   R   R   R	   R
   R   R„   t   filenot   readablet   writable(   t   conn(    (    s4   /mit/python/lib/python2.6/multiprocessing/forking.pyt   reduce_connection  s    c   
   
   C   s×  t  i t i d ƒ d |  j o |  d t i ƒ  _ n d |  j o |  d t i ƒ  _ n d |  j o |  d o t i	 ƒ  n d |  j o t i
 ƒ  i |  d ƒ n d |  j o |  d t _ n d |  j o |  d t _ n d |  j o t i |  d ƒ n d	 |  j o |  d	 t _ n d
 |  j o |  d
 } t i i t i i | ƒ ƒ d } | d j o" t i i t i i | ƒ ƒ } n | d j o4d d k } | d j o
 d } nW t i i | ƒ i d ƒ o% t i i t i i | ƒ ƒ g } n t i i | ƒ g } | i | | ƒ \ } } } z | i d | | | ƒ } Wd | o | i ƒ  n X| t i d <d | _ xR | i i ƒ  D]= }	 y! |	 i d j o d |	 _ n WqŠt j
 o qŠXqŠWqÓn d S(   sE   
    Try to get current process ready to unpickle process object
    R¬   R¥   Rª   R¨   R«   R¦   R§   t   dirR©   R¯   i    R:   t   ipythoniÿÿÿÿNs   __init__.pyt   __parents_main__(   t   old_main_modulest   appendR,   R4   R   R–   R¥   t   _authkeyR    R¨   t
   get_loggert   setLevelR±   R’   R1   t   chdirR²   t   splitextt   basenamet   dirnamet   impR   t
   startswitht   find_modulet   load_moduleR   R   t   __dict__t   valuesR   t	   Exception(
   t   dataR¯   t	   main_nameRÉ   t   dirsRZ   t	   path_namet   etct   main_moduleR   (    (    s4   /mit/python/lib/python2.6/multiprocessing/forking.pyRž   “  sX    
""
%	 (D   R1   R,   RL   t   multiprocessingR    R   t   __all__R   t   pickleR   R   R    R   R
   t   saveR"   t   listRÁ   Rx   t   __add__t	   functoolsR#   t   ImportErrorR)   R$   t   platformRB   R7   R   t   dupR   R   t   objectR   R   Rm   R`   t   _multiprocessingR*   RT   RU   RV   RW   RX   R   RY   RŠ   R   RQ   R´   t   ExitProcesst   CloseHandleR˜   t   lowert   endswithR±   Rq   t   exec_prefixR]   R_   R“   R•   Rp   R”   Ru   R¼   RÀ   Rž   (    (    (    s4   /mit/python/lib/python2.6/multiprocessing/forking.pyt   <module>	   sj   	
							="				N						"		