Your IP : 3.21.12.122


Current Path : /opt/alt/python33/lib64/python3.3/multiprocessing/__pycache__/
Upload File :
Current File : //opt/alt/python33/lib64/python3.3/multiprocessing/__pycache__/reduction.cpython-33.pyo

�
��f%c@sddddgZddlZddlZddlZddlZddlZddlZddlmZddl	m
Z
mZmZddl	m
Z
mZejd	kp�eed
�o�eed�s�ed��nejd	kr�ed
g7ZddlZdd�Zdd�ZGdd�de�ZGdd�de�Zdd�Zdd�Zdd�Zdd�Zdd
�Zdd�ZnmejdkZdd�Zdd�ZGd d!�d!e�Zd"d�Zd#d�Zd$d�Zd%d�ZGd&d'�d'e�Z e �Z!dS((u
reduce_socketureduce_connectionusend_handleurecv_handleiN(ucurrent_process(uregister_after_forkudebugu	sub_debug(u
is_exitingusub_warninguwin32uCMSG_LENu
SCM_RIGHTSu%pickling of connections not supportedureduce_pipe_connectioncCs&t|tj|�}|j|�dS(N(u	DupHandleu_winapiuDUPLICATE_SAME_ACCESSusend(uconnuhandleudestination_pidudh((u>/opt/alt/python33/lib64/python3.3/multiprocessing/reduction.pyusend_handle*scCs|j�j�S(N(urecvudetach(uconn((u>/opt/alt/python33/lib64/python3.3/multiprocessing/reduction.pyurecv_handle.scBs/|EeZdZddd�Zdd�ZdS(u	DupHandlec
Cs�|dkrtj�}ntjtjd|�}z+tjtj�|||dd�|_	Wdtj
|�X||_||_dS(NiF(
uNoneuosugetpidu_winapiuOpenProcessuPROCESS_DUP_HANDLEuFalseuDuplicateHandleuGetCurrentProcessu_handleuCloseHandleu_accessu_pid(uselfuhandleuaccessupiduproc((u>/opt/alt/python33/lib64/python3.3/multiprocessing/reduction.pyu__init__2s		uDupHandle.__init__c
Cs{|jtj�kr|jStjtjd|j�}z/tj||jtj	�|j
dtj�SWdtj|�XdS(NF(
u_piduosugetpidu_handleu_winapiuOpenProcessuPROCESS_DUP_HANDLEuFalseuDuplicateHandleuGetCurrentProcessu_accessuDUPLICATE_CLOSE_SOURCEuCloseHandle(uselfuproc((u>/opt/alt/python33/lib64/python3.3/multiprocessing/reduction.pyudetach@suDupHandle.detachN(u__name__u
__module__u__qualname__uNoneu__init__udetach(u
__locals__((u>/opt/alt/python33/lib64/python3.3/multiprocessing/reduction.pyu	DupHandle1su	DupHandlecBs,|EeZdZdd�Zdd�ZdS(u	DupSocketcs:|j���fdd�}tj|�j�|_dS(Ncs �j|�}|j|�dS(N(ushareu
send_bytes(uconnupidushare(unew_sock(u>/opt/alt/python33/lib64/python3.3/multiprocessing/reduction.pyusendPsu DupSocket.__init__.<locals>.send(udupuresource_shareruregisterucloseu_id(uselfusockusend((unew_socku>/opt/alt/python33/lib64/python3.3/multiprocessing/reduction.pyu__init__NsuDupSocket.__init__c
CsAtj|j�}z|j�}tj|�SWd|j�XdS(N(uresource_shareruget_connectionu_idu
recv_bytesusocketu	fromshareuclose(uselfuconnushare((u>/opt/alt/python33/lib64/python3.3/multiprocessing/reduction.pyudetachUs
uDupSocket.detachN(u__name__u
__module__u__qualname__u__init__udetach(u
__locals__((u>/opt/alt/python33/lib64/python3.3/multiprocessing/reduction.pyu	DupSocketMsu	DupSocketcCstt|�ffS(N(urebuild_socketu	DupSocket(us((u>/opt/alt/python33/lib64/python3.3/multiprocessing/reduction.pyu
reduce_socket]scCs
|j�S(N(udetach(uds((u>/opt/alt/python33/lib64/python3.3/multiprocessing/reduction.pyurebuild_socket`surebuild_socketcCsY|j�}tj|tjtj��,}t|�}t||j|jffSWdQXdS(N(	ufilenousocketufromfduAF_INETuSOCK_STREAMu	DupSocketurebuild_connectionureadableuwritable(uconnuhandleusuds((u>/opt/alt/python33/lib64/python3.3/multiprocessing/reduction.pyureduce_connectioncscCs2ddlm}|j�}||j�||�S(Ni(u
Connection(u
connectionu
Connectionudetach(udsureadableuwritableu
Connectionusock((u>/opt/alt/python33/lib64/python3.3/multiprocessing/reduction.pyurebuild_connectionisurebuild_connectioncCs\|jrtjnd|jr'tjndB}t|j�|�}t||j|jffS(Ni(ureadableu_winapiuFILE_GENERIC_READuwritableuFILE_GENERIC_WRITEu	DupHandleufilenourebuild_pipe_connection(uconnuaccessudh((u>/opt/alt/python33/lib64/python3.3/multiprocessing/reduction.pyureduce_pipe_connectionnscCs,ddlm}|j�}||||�S(Ni(uPipeConnection(u
connectionuPipeConnectionudetach(udhureadableuwritableuPipeConnectionuhandle((u>/opt/alt/python33/lib64/python3.3/multiprocessing/reduction.pyurebuild_pipe_connectiontsurebuild_pipe_connectionudarwincCs�tj|j�tjtj��8}|jdgtjtjtj	d|�fg�WdQXt
r�|j�dkr�td��ndS(Nsxu@isACKu%did not receive acknowledgement of fd(
usocketufromfdufilenouAF_UNIXuSOCK_STREAMusendmsgu
SOL_SOCKETu
SCM_RIGHTSustructupackuACKNOWLEDGEu
recv_bytesuRuntimeError(uconnuhandleudestination_pidus((u>/opt/alt/python33/lib64/python3.3/multiprocessing/reduction.pyusend_handles
$c
Cs�tjd�}tj|j�tjtj���}|jdtj|��\}}}}yit	rs|j
d�n|d\}}}	|tjkr�|tjkr�tj
d|	d|��dSWntttjfk
r�YnXtd��WdQXdS(Nu@iisACKiuInvalid data received(ustructucalcsizeusocketufromfdufilenouAF_UNIXuSOCK_STREAMurecvmsguCMSG_LENuACKNOWLEDGEu
send_bytesu
SOL_SOCKETu
SCM_RIGHTSuunpacku
ValueErroru
IndexErroruerroruRuntimeError(
uconnusizeusumsguancdatauflagsuaddru
cmsg_levelu	cmsg_typeu	cmsg_data((u>/opt/alt/python33/lib64/python3.3/multiprocessing/reduction.pyurecv_handle�s$'"cBs,|EeZdZdd�Zdd�ZdS(uDupFdcsLtj|���fdd�}�fdd�}tj||�|_dS(Ncst|�|�dS(N(usend_handle(uconnupid(unew_fd(u>/opt/alt/python33/lib64/python3.3/multiprocessing/reduction.pyusend�suDupFd.__init__.<locals>.sendcstj��dS(N(uosuclose((unew_fd(u>/opt/alt/python33/lib64/python3.3/multiprocessing/reduction.pyuclose�suDupFd.__init__.<locals>.close(uosudupuresource_shareruregisteru_id(uselfufdusenduclose((unew_fdu>/opt/alt/python33/lib64/python3.3/multiprocessing/reduction.pyu__init__�suDupFd.__init__c
Cs2tj|j�}zt|�SWd|j�XdS(N(uresource_shareruget_connectionu_idurecv_handleuclose(uselfuconn((u>/opt/alt/python33/lib64/python3.3/multiprocessing/reduction.pyudetach�suDupFd.detachN(u__name__u
__module__u__qualname__u__init__udetach(u
__locals__((u>/opt/alt/python33/lib64/python3.3/multiprocessing/reduction.pyuDupFd�suDupFdcCs1t|j��}t||j|j|jffS(N(uDupFdufilenourebuild_socketufamilyutypeuproto(usudf((u>/opt/alt/python33/lib64/python3.3/multiprocessing/reduction.pyu
reduce_socket�scCs5|j�}tj||||�}tj|�|S(N(udetachusocketufromfduosuclose(udfufamilyutypeuprotoufdus((u>/opt/alt/python33/lib64/python3.3/multiprocessing/reduction.pyurebuild_socket�s
cCs+t|j��}t||j|jffS(N(uDupFdufilenourebuild_connectionureadableuwritable(uconnudf((u>/opt/alt/python33/lib64/python3.3/multiprocessing/reduction.pyureduce_connection�scCs,ddlm}|j�}||||�S(Ni(u
Connection(u
connectionu
Connectionudetach(udfureadableuwritableu
Connectionufd((u>/opt/alt/python33/lib64/python3.3/multiprocessing/reduction.pyurebuild_connection�scBsq|EeZdZdd�Zdd�Zedd��Zddd�Zd	d
�Z	dd�Z
d
d�ZdS(uResourceSharercCsYd|_i|_g|_tj�|_d|_d|_d|_	t
|tj�dS(Ni(
u_keyu_cacheu
_old_locksu	threadinguLocku_lockuNoneu	_listeneru_addressu_threaduregister_after_forkuResourceShareru
_afterfork(uself((u>/opt/alt/python33/lib64/python3.3/multiprocessing/reduction.pyu__init__�s						uResourceSharer.__init__c
Cse|j�V|jdkr&|j�n|jd7_||f|j|j<|j|jfSWdQXdS(Ni(u_locku_addressuNoneu_startu_keyu_cache(uselfusenduclose((u>/opt/alt/python33/lib64/python3.3/multiprocessing/reduction.pyuregister�s

uResourceSharer.registercCsQddlm}|\}}||dt�j�}|j|tj�f�|S(Ni(uClientuauthkey(u
connectionuClientucurrent_processuauthkeyusenduosugetpid(uidentuClientuaddressukeyuc((u>/opt/alt/python33/lib64/python3.3/multiprocessing/reduction.pyuget_connection�s
uResourceSharer.get_connectioncCs�ddlm}|j��|jdk	r�||jdt�j�}|jd�|j�|j	j
|�|j	j�r�td�n|j
j�d|_	d|_d|_
x*|jj�D]\}\}}|�q�W|jj�nWdQXdS(Ni(uClientuauthkeyu-ResourceSharer thread did not stop when asked(u
connectionuClientu_locku_addressuNoneucurrent_processuauthkeyusenducloseu_threadujoinuis_aliveusub_warnu	_listeneru_cacheuitemsuclear(uselfutimeoutuClientucukeyusenduclose((u>/opt/alt/python33/lib64/python3.3/multiprocessing/reduction.pyustop�s 




			"uResourceSharer.stopcCs�x*|jj�D]\}\}}|�qW|jj�|jj|j�tj�|_|jdk	r{|jj
�nd|_d|_d|_dS(N(
u_cacheuitemsuclearu
_old_locksuappendu_locku	threadinguLocku	_listeneruNoneucloseu_addressu_thread(uselfukeyusenduclose((u>/opt/alt/python33/lib64/python3.3/multiprocessing/reduction.pyu
_afterfork�s"
		uResourceSharer._afterforkcCsvddlm}td�|dt�j�|_|jj|_tj	d|j
�}d|_|j
�||_dS(Ni(uListeneru0starting listener and thread for sending handlesuauthkeyutargetT(u
connectionuListenerudebugucurrent_processuauthkeyu	_listeneruaddressu_addressu	threadinguThreadu_serveuTrueudaemonustartu_thread(uselfuListenerut((u>/opt/alt/python33/lib64/python3.3/multiprocessing/reduction.pyu_start�s
	
uResourceSharer._startc
Cs�ttd�r1tjtjtdtj��nx�yq|jj�}|j�}|dkrbPn|\}}|j
j|�\}}|||�|�|j�Wq4t
�s�ddl}tdddd|j�dd�nYq4Xq4dS(Nupthread_sigmaskiiu.thread for sharing handles raised exception :
u-iOu
(uhasattrusignalupthread_sigmasku	SIG_BLOCKurangeuNSIGu	_listeneruaccepturecvuNoneu_cacheupopucloseu
is_exitingu	tracebackusub_warningu
format_exc(uselfuconnumsgukeyudestination_pidusenducloseu	traceback((u>/opt/alt/python33/lib64/python3.3/multiprocessing/reduction.pyu_serves$"
	uResourceSharer._serveN(u__name__u
__module__u__qualname__u__init__uregisterustaticmethoduget_connectionuNoneustopu
_afterforku_startu_serve(u
__locals__((u>/opt/alt/python33/lib64/python3.3/multiprocessing/reduction.pyuResourceSharer�s
uResourceSharer("u__all__uosusysusocketu	threadingustructusignalumultiprocessingucurrent_processumultiprocessing.utiluregister_after_forkudebugu	sub_debugu
is_exitingusub_warninguplatformuhasattruImportErroru_winapiusend_handleurecv_handleuobjectu	DupHandleu	DupSocketu
reduce_socketurebuild_socketureduce_connectionurebuild_connectionureduce_pipe_connectionurebuild_pipe_connectionuACKNOWLEDGEuDupFduResourceShareruresource_sharer(((u>/opt/alt/python33/lib64/python3.3/multiprocessing/reduction.pyu<module>sF
		\

?>