ó õùPc@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*..\python\lib\multiprocessing\reduction.pyt send_handle's cCs |jƒS(N(trecv(R((s*..\python\lib\multiprocessing\reduction.pyt recv_handle1scCstj|jƒ|ƒdS(N(t_multiprocessingtsendfdtfileno(RRR((s*..\python\lib\multiprocessing\reduction.pyR5scCstj|jƒƒS(N(RR R(R((s*..\python\lib\multiprocessing\reduction.pyR8scCs;xtD]}t|ƒqWtjƒtjƒadadS(N(t_cacheRtcleart threadingtLockt_locktNonet _listener(tobjth((s*..\python\lib\multiprocessing\reduction.pyt_resetAs    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*..\python\lib\multiprocessing\reduction.pyt _get_listenerLs     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*..\python\lib\multiprocessing\reduction.pyR)]s     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*..\python\lib\multiprocessing\reduction.pyt reduce_handlets     cCsq|\}}}|r|Std|ƒt|dtƒjƒ}|j|tjƒfƒt|ƒ}|jƒ|S(Nsrebuilding handle %dR%( RRRR%RtostgetpidRR(t pickled_dataR<Rt inheritedRR((s*..\python\lib\multiprocessing\reduction.pytrebuild_handle|s   cCs+t|jƒƒ}t||j|jffS(N(R>Rtrebuild_connectiontreadabletwritable(Rtrh((s*..\python\lib\multiprocessing\reduction.pytreduce_connection‹scCs%t|ƒ}tj|d|d|ƒS(NRERF(RCRt Connection(treduced_handleRERFR((s*..\python\lib\multiprocessing\reduction.pyRDs icCsCtj||||ƒ}|jtjk r?tjd|ƒ}n|S(Nt_sock(tsockettfromfdt __class__(tfdtfamilyttype_tprotots((s*..\python\lib\multiprocessing\reduction.pyRM›scCs1t|jƒƒ}t||j|j|jffS(N(R>Rtrebuild_socketRPttypeRR(RSRJ((s*..\python\lib\multiprocessing\reduction.pyt reduce_socket¡scCs/t|ƒ}t||||ƒ}t|ƒ|S(N(RCRMR(RJRPRQRRRORK((s*..\python\lib\multiprocessing\reduction.pyRT¥s  cCs+t|jƒƒ}t||j|jffS(N(R>Rtrebuild_pipe_connectionRERF(RRG((s*..\python\lib\multiprocessing\reduction.pytreduce_pipe_connection³scCs%t|ƒ}tj|d|d|ƒS(NRERF(RCRtPipeConnection(RJRERFR((s*..\python\lib\multiprocessing\reduction.pyRW·s (-t__all__R?tsysRLRRtmultiprocessingRtmultiprocessing.forkingRRRRtmultiprocessing.utilRRRtmultiprocessing.connectionRR tplatformthasattrt ImportErrort _subprocessR RRtsetRR$R R/R)R>RCRHRDtregisterRIRMRVRTRXRWRY(((s*..\python\lib\multiprocessing\reduction.pyt sJ     "