��Qc@sgZddlZddlZddlZddlZddlZddlmZddlm Z m
Z
mZmZddl
mZmZmZddlmZmZejdkp�eed�s�ed��nejdkrddlZdd lmZd
�Zd�Znd�Zd
�Ze�ad�Zed�eee�d�Zd�Z d�Z!d�Z"d�Z#d�Z$ej%ej&e#�dd�Z'd�Z(d�Z)ej%eje(�ejdkr��Z*d�Z+ej%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
tOpenProcesstPROCESS_ALL_ACCESStFalseRtsendR(tconnthandletdestination_pidtprocess_handlet
new_handle((s//sys/lib/python2.7/multiprocessing/reduction.pytsend_handleAscCs
|j�S(N(trecv(R((s//sys/lib/python2.7/multiprocessing/reduction.pytrecv_handleKscCstj|j�|�dS(N(t_multiprocessingtsendfdtfileno(RRR((s//sys/lib/python2.7/multiprocessing/reduction.pyROscCstj|j��S(N(RRR(R((s//sys/lib/python2.7/multiprocessing/reduction.pyRRscCs;xtD]}t|�qWtj�tj�adadS(N(t_cacheRtcleart threadingtLockt_locktNonet _listener(tobjth((s//sys/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//sys/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_exitingtsub_warningi�s.thread for sharing handles raised exception :
t-iOs
(tutilR0R1R!tacceptRRtremoveRRt tracebackt
format_exc(R0R1Rt
handle_wantedRR6((s//sys/lib/python2.7/multiprocessing/reduction.pyR)ws
cCs[tj�r"dtj|�tfSt|�}tj|�td|�t �j
|tfS(Nsreducing handle %d(Rtthread_is_spawningR tduplicate_for_childR*RRtaddRR/taddressR(Rt
dup_handle((s//sys/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(tpickled_dataR<Rt inheritedRR((s//sys/lib/python2.7/multiprocessing/reduction.pytrebuild_handle�s
cCs+t|j��}t||j|jffS(N(R>Rtrebuild_connectiontreadabletwritable(Rtrh((s//sys/lib/python2.7/multiprocessing/reduction.pytreduce_connection�scCs%t|�}tj|d|d|�S(NRERF(RCRt
Connection(treduced_handleRERFR((s//sys/lib/python2.7/multiprocessing/reduction.pyRD�sicCsCtj||||�}|jtjk r?tjd|�}n|S(Nt_sock(tsockettfromfdt __class__(tfdtfamilyttype_tprotots((s//sys/lib/python2.7/multiprocessing/reduction.pyRM�scCs1t|j��}t||j|j|jffS(N(R>Rtrebuild_socketRPttypeRR(RSRJ((s//sys/lib/python2.7/multiprocessing/reduction.pyt
reduce_socket�scCs/t|�}t||||�}t|�|S(N(RCRMR(RJRPRQRRRORK((s//sys/lib/python2.7/multiprocessing/reduction.pyRT�s
cCs+t|j��}t||j|jffS(N(R>Rtrebuild_pipe_connectionRERF(RRG((s//sys/lib/python2.7/multiprocessing/reduction.pytreduce_pipe_connection�scCs%t|�}tj|d|d|�S(NRERF(RCRtPipeConnection(RJRERFR((s//sys/lib/python2.7/multiprocessing/reduction.pyRW�s(-t__all__R?tsysRLRRtmultiprocessingRtmultiprocessing.forkingRRRRtmultiprocessing.utilRRRtmultiprocessing.connectionRR tplatformthasattrtImportErrort_subprocessR
RRtsetRR$R R/R)R>RCRHRDtregisterRIRMRVRTRXRWRY(((s//sys/lib/python2.7/multiprocessing/reduction.pyt<module>$sJ"
|