Viewing File: /opt/alt/python35/lib64/python3.5/multiprocessing/__pycache__/resource_sharer.cpython-35.opt-2.pyc



]@sddlZddlZddlZddlZddlZddlmZddlmZddlmZdgZ	ej
dkre	dg7Z	Gd	ddeZn#e	d
g7Z	Gdd
d
eZ
Gdd
d
eZeZejZdS)N)process)	reduction)utilstopwin32	DupSocketc@s(eZdZddZddZdS)rcs:|jfdd}tj|j|_dS)Ncs j|}|j|dS)N)share
send_bytes)connpidr	)new_sock4/opt/alt/python35/lib64/python3.5/resource_sharer.pysendsz DupSocket.__init__.<locals>.send)dup_resource_sharerregisterclose_id)selfsockrr)r
r__init__szDupSocket.__init__c	Cs9tj|j }|j}tj|SWdQRXdS)N)rget_connectionr
recv_bytessocketZ	fromshare)rrr	rrrdetach$szDupSocket.detachN)__name__
__module____qualname__rrrrrrrsDupFdc@s(eZdZddZddZdS)r csLtj|fdd}fdd}tj|||_dS)Ncstj||dS)N)rsend_handle)rr)new_fdrrr1szDupFd.__init__.<locals>.sendcstjdS)N)osrr)r"rrr3szDupFd.__init__.<locals>.close)r#rrrr)rfdrrr)r"rr/szDupFd.__init__c	Cs-tj|j}tj|SWdQRXdS)N)rrrrrecv_handle)rrrrrr7szDupFd.detachN)rrrrrrrrrr -sc@smeZdZddZddZeddZddd	Zd
dZdd
Z	ddZ
dS)_ResourceSharercCs\d|_i|_g|_tj|_d|_d|_d|_t	j
|tjdS)Nr)
_key_cache
_old_locks	threadingLock_lock	_listener_address_threadrregister_after_forkr&
_afterfork)rrrrr?s						z_ResourceSharer.__init__c
Csc|jS|jdkr#|j|jd7_||f|j|j<|j|jfSWdQRXdS)Nr)r,r._startr'r()rrrrrrrIs

z_ResourceSharer.registercCsTddlm}|\}}||dtjj}|j|tjf|S)Nr)Clientauthkey)
connectionr3rcurrent_processr4rr#getpid)identr3addresskeycrrrrRs
z_ResourceSharer.get_connectionNcCsddlm}|j|jdk	r||jdtjj}|jd|j|j	j
||j	jrtj
d|jjd|_	d|_d|_x*|jjD]\}\}}|qW|jjWdQRXdS)Nr)r3r4z._ResourceSharer thread did not stop when asked)r5r3r,r.rr6r4rrr/joinis_aliversub_warningr-r(itemsclear)rtimeoutr3r;r:rrrrrr[s"




			"z_ResourceSharer.stopcCsx*|jjD]\}\}}|qW|jj|jj|jtj|_|jdk	rx|jj	d|_d|_
d|_dS)N)r(r?r@r)appendr,r*r+r-rr.r/)rr:rrrrrr1ps"

		z_ResourceSharer._afterforkcCs|ddlm}tjd|dtjj|_|jj|_	t
jd|j}d|_
|j||_dS)Nr)Listenerz0starting listener and thread for sending handlesr4targetT)r5rCrdebugrr6r4r-r9r.r*Thread_servedaemonstartr/)rrCtrrrr2~s
	
z_ResourceSharer._startcCsttdr.tjtjtdtjxyv|jj`}|j}|dkr_P|\}}|j	j
|\}}z|||Wd|XWdQRXWq1tjst
jt
jYq1Xq1WdS)Npthread_sigmaskr)hasattrsignalrK	SIG_BLOCKrangeNSIGr-acceptrecvr(popr
is_exitingsys
excepthookexc_info)rrmsgr:destination_pidrrrrrrGs z_ResourceSharer._serve)rrrrrstaticmethodrrr1r2rGrrrrr&=s
		r&)r#rMrrUr*rrr__all__platformobjectrr r&rrrrrr<module>s 	

`	
Back to Directory File Manager