HEX
Server: Apache
System: Linux server2.voipitup.com.au 4.18.0-553.104.1.lve.el8.x86_64 #1 SMP Tue Feb 10 20:07:30 UTC 2026 x86_64
User: posscale (1027)
PHP: 8.2.29
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //proc/thread-self/root/lib64/python3.6/site-packages/zmq/utils/__pycache__/garbage.cpython-36.pyc
3

VS�_/�@s�dZddlZddlZddlmZddlmZddlmZm	Z	m
Z
ddlZddlZedddg�Z
Gd	d
�d
e�ZGdd�de�Ze�ZdS)
zcGarbage collection thread for representing zmq refcount of Python objects
used in zero-copy sends.
�N)�getpid)�
namedtuple)�Thread�Event�Lock�gcref�obj�eventcs(eZdZdZ�fdd�Zdd�Z�ZS)�GarbageCollectorThreadz4Thread in which garbage collection actually happens.cs.tt|�j�||_d|_t�|_t�|_dS)NT)	�superr
�__init__�gcZdaemonr�pidr�ready)�selfr
)�	__class__��/usr/lib64/python3.6/garbage.pyrs
zGarbageCollectorThread.__init__cCs�tdkst�|jkr"|jj�dSz(|jjjtj�}d|_	|j
|jj�Wd|jj�Xxxtdksnt�|jkrrdS|j�}|dkr�Pt
|�dkr�dnd}tj||�d}|jjj|d�}|r�|jr�|jj�~qZW|j�dS)NrsDIE��L�Q)rrr�setr
�context�socket�zmqZPULLZlingerZbind�urlZrecv�len�struct�unpack�refs�popr	�close)r�s�msgZfmt�key�tuprrr�runs*


zGarbageCollectorThread.run)�__name__�
__module__�__qualname__�__doc__rr&�
__classcell__rr)rrr
sr
cs�eZdZdZdZdZdZdZd�fdd�	Ze	dd��Z
e
jdd��Z
d	d
�Zdd�Z
d
d�Ze	dd��Zdd�Zdd�Zddd�Zdd�Z�ZS)�GarbageCollectoraNPyZMQ 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.
    Nzinproc://pyzmq.gc.01csPtt|�j�i|_d|_d|_||_t�|_d|_	d|_
d|_tj
|j�dS)NF)rr,rrr�thread�_contextr�_lock�
_stay_down�_push�_push_mutex�atexit�register�_atexit)rr)rrrrOszGarbageCollector.__init__cCs>|jdkr8tjjd�r.ddlm}|j�|_n
tj�|_|jS)NZgeventr)�green)r.rr(�
startswithrr6ZContext)rr6rrrr[s

zGarbageCollector.contextcCs,|j�r"|jrtjdt�|j�||_dS)Nz(Replacing gc context while gc is running)�is_aliver�warnings�warn�RuntimeWarning�stopr.)rZctxrrrrfs
cCsd|_|j�dS)z�atexit callback
        
        sets _stay_down flag so that gc doesn't try to start up again in other atexit handlers
        TN)r0r<)rrrrr5nszGarbageCollector._atexitcCs|j�sdS|j�dS)z"stop the garbage-collection threadN)r8�_stop)rrrrr<vszGarbageCollector.stopcCsp|jjtj�}|j|j�|jd�|j�|jrB|jj�d|_d|_	|j
j�|jj�|j
j�d|_dS)NsDIE)rrr�PUSH�connectr�sendr!r1r2r-�joinZtermr�clear)r�pushrrrr=|s




zGarbageCollector._stopcCs8|j�s|jdkr2|jjtj�|_|jj|j�|jS)zHThe PUSH socket for use in the zmq message destructor callback.
        N)r8r1rrrr>r?r)rrrr�_push_socket�szGarbageCollector._push_socketcCsP|jdk	r|jt�kr|j�t�|_i|_t|�|_|jj�|jjj�dS)z�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-rrr=rr
�startr�wait)rrrrrE�s

zGarbageCollector.startcCs2tdks*t�|jks*|jdks*|jj�r.dSdS)z{Is the garbage collection thread currently running?
        
        Includes checks for process shutdown or fork.
        NFT)rrr-r8)rrrrr8�s
zGarbageCollector.is_alivec
CsT|j�s4|jrdS|j�|j�s*|j�WdQRXt||�}t|�}||j|<|S)z4store an object and (optionally) event for zero-copyrN)r8r0r/rEr�idr)rrr	r%Ztheidrrr�store�s

zGarbageCollector.storecCsD|j�sdSy|j�Wn&tk
r>}z
|�WYdd}~XnXdS)N)r8r<�	Exception)r�errr�__del__�szGarbageCollector.__del__)N)N)r'r(r)r*rr.r/rr�propertyr�setterr5r<r=rDrEr8rHrKr+rr)rrr,;s 
	
r,)r*r3r�osr�collectionsrZ	threadingrrrr9rrr
�objectr,r
rrrr�<module>s%