ó û^‚Rc@sgZddlZddlZddlZddlZddlZddlmZddlm Z m Z m Z m Z ddl mZmZmZddlmZmZejdkpÁeedƒsÓedƒ‚nejdkrddlZdd lmZd „Zd „Znd „Zd „Zeƒad„Zedƒeeeƒd„Zd„Z d„Z!d„Z"d„Z#d„Z$e j%ej&e#ƒdd„Z'd„Z(d„Z)e j%eje(ƒejdkrÿd„Z*d„Z+e j%ej,e*ƒndS(iÿÿÿÿN(tcurrent_process(tPopent duplicatetclosetForkingPickler(tregister_after_forktdebugt sub_debug(tClienttListenertwin32trecvfds%pickling of connections not supported(R cCsJtjtjt|ƒ}z t||ƒ}|j|ƒWdt|ƒXdS(N(R t OpenProcesstPROCESS_ALL_ACCESStFalseRtsendR(tconnthandletdestination_pidtprocess_handlet new_handle((s//usr/lib/python2.7/multiprocessing/reduction.pyt send_handleAs cCs |jƒS(N(trecv(R((s//usr/lib/python2.7/multiprocessing/reduction.pyt recv_handleKscCstj|jƒ|ƒdS(N(t_multiprocessingtsendfdtfileno(RRR((s//usr/lib/python2.7/multiprocessing/reduction.pyROscCstj|jƒƒS(N(RR R(R((s//usr/lib/python2.7/multiprocessing/reduction.pyRRscCs;xtD]}t|ƒqWtjƒtjƒadadS(N(t_cacheRtcleart threadingtLockt_locktNonet _listener(tobjth((s//usr/lib/python2.7/multiprocessing/reduction.pyt_reset[s    cCs‚tdkr~tjƒzWtdkrltdƒtdtƒjƒatj dt ƒ}t |_ |j ƒnWdtjƒXntS(Ns0starting listener and thread for sending handlestauthkeyttarget(R!R RtacquireRR RR%RtThreadt_servetTruetdaemontstarttrelease(tt((s//usr/lib/python2.7/multiprocessing/reduction.pyt _get_listenerfs     cCs½ddlm}m}x yStjƒ}|jƒ\}}tj|ƒt|||ƒt |ƒ|j ƒWq|ƒs¶ddl }|dddd|j ƒddƒq¶qXqdS(Ni(t is_exitingt sub_warningiÿÿÿÿs.thread for sharing handles raised exception : t-iOs ( tutilR0R1R!tacceptRRtremoveRRt tracebackt format_exc(R0R1Rt handle_wantedRR6((s//usr/lib/python2.7/multiprocessing/reduction.pyR)ws     cCs[tjƒr"dtj|ƒtfSt|ƒ}tj|ƒtd|ƒt ƒj |t fS(Nsreducing handle %d( Rtthread_is_spawningR tduplicate_for_childR*RRtaddRR/taddressR(Rt dup_handle((s//usr/lib/python2.7/multiprocessing/reduction.pyt reduce_handleŽs     cCsq|\}}}|r|Std|ƒt|dtƒjƒ}|j|tjƒfƒt|ƒ}|jƒ|S(Nsrebuilding handle %dR%( RRRR%RtostgetpidRR(t pickled_dataR<Rt inheritedRR((s//usr/lib/python2.7/multiprocessing/reduction.pytrebuild_handle–s   cCs+t|jƒƒ}t||j|jffS(N(R>Rtrebuild_connectiontreadabletwritable(Rtrh((s//usr/lib/python2.7/multiprocessing/reduction.pytreduce_connection¥scCs%t|ƒ}tj|d|d|ƒS(NRERF(RCRt Connection(treduced_handleRERFR((s//usr/lib/python2.7/multiprocessing/reduction.pyRD©s icCsCtj||||ƒ}|jtjk r?tjd|ƒ}n|S(Nt_sock(tsockettfromfdt __class__(tfdtfamilyttype_tprotots((s//usr/lib/python2.7/multiprocessing/reduction.pyRMµscCs1t|jƒƒ}t||j|j|jffS(N(R>Rtrebuild_socketRPttypeRR(RSRJ((s//usr/lib/python2.7/multiprocessing/reduction.pyt reduce_socket»scCs/t|ƒ}t||||ƒ}t|ƒ|S(N(RCRMR(RJRPRQRRRORK((s//usr/lib/python2.7/multiprocessing/reduction.pyRT¿s  cCs+t|jƒƒ}t||j|jffS(N(R>Rtrebuild_pipe_connectionRERF(RRG((s//usr/lib/python2.7/multiprocessing/reduction.pytreduce_pipe_connectionÍscCs%t|ƒ}tj|d|d|ƒS(NRERF(RCRtPipeConnection(RJRERFR((s//usr/lib/python2.7/multiprocessing/reduction.pyRWÑs (-t__all__R?tsysRLRRtmultiprocessingRtmultiprocessing.forkingRRRRtmultiprocessing.utilRRRtmultiprocessing.connectionRR tplatformthasattrt ImportErrort _subprocessR RRtsetRR$R R/R)R>RCRHRDtregisterRIRMRVRTRXRWRY(((s//usr/lib/python2.7/multiprocessing/reduction.pyt$sJ     "