HEX
Server: Apache
System: Linux zacp120.webway.host 4.18.0-553.50.1.lve.el8.x86_64 #1 SMP Thu Apr 17 19:10:24 UTC 2025 x86_64
User: govancoz (1003)
PHP: 8.3.26
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: //usr/local/lib/python3.10/test/support/__pycache__/threading_helper.cpython-310.opt-2.pyc
o

�i��@s�ddlZddlZddlZddlZddlZddlZddlmZdd�Zdd�Z	dd�Z
ejdd	d
��Zddd�Z
ejdd
d��ZGdd�d�ZdS)�N)�supportcCst��tj��fS�N)�_thread�_count�	threading�	_dangling�copy�r	r	�:/usr/local/lib/python3.10/test/support/threading_helper.py�threading_setupsrc
Gs�d}t|�D]L}t��tjf}||krdS|sGdt_|d}t�d|d|d�d|d�dt|��d��|D]
}t�d	|���q:d}d}t	�
d
�t��qdS)N�dT�z&threading_cleanup() failed to cleanup rz threads (count: z, dangling: �)zDangling thread: �{�G�z�?)�rangerrrrrZenvironment_alteredZ
print_warning�len�time�sleep�
gc_collect)Zoriginal_valuesZ
_MAX_COUNT�count�valuesZdangling_threads�threadr	r	r
�threading_cleanups,��
�

�rcs	t����fdd��}|S)Ncs$t�}z	�|�Wt|�St|�wr)rr)�args�key��funcr	r
�	decorator:szreap_threads.<locals>.decorator)�	functools�wraps)rrr	rr
�reap_threads6sr ccs �	|dur	tj}t��}zCdVWt��}||}	t��}||kr%dSt��|krGt��|}d||�d|d�d|�d|�d�	}t|��t�d�t��qt��}||}	t��}||krd	wt��|kr�t��|}d||�d|d�d|�d|�d�	}t|��t�d�t��qZ)	NTz!wait_threads() failed to cleanup z threads after �.1fz seconds (count: z
, old count: rr)	r�
SHORT_TIMEOUTrrr�	monotonic�AssertionErrorrr)�timeoutZ	old_countZ
start_time�deadlinerZdt�msgr	r	r
�wait_threads_exitDs\�
���
������
�r(cCs<	|durtj}|�|�|��rd|d�d�}t|��dS)Nzfailed to join the thread in r!z seconds)rr"�join�is_aliver$)rr%r'r	r	r
�join_threadis
�r+ccs,�ddl}t|�}g}z�z|D]}|��|�|�qWntjr/tdt|�t|�f��dVWzX|r:|�t�	�}t
dd�D]/}|d7}|D]}|�t|t�	�d��qKdd�|D�}|sentjrrtd	t|�|f�qCWd
d�|D�}|r�|�
tj�tdt|���dSd
d�|D�}|r�|�
tj�tdt|���wzW|r�|�t�	�}t
dd�D]/}|d7}|D]}|�t|t�	�d��q�dd�|D�}|s�ntjr�td	t|�|f�q�Wd
d�|D�}|r�|�
tj�tdt|���wd
d�|D�}|�r|�
tj�tdt|���w)Nrz/Can't start %d threads, only %d threads startedr
��<rcS�g|]}|��r|�qSr	�r*��.0�tr	r	r
�
<listcomp>��z!start_threads.<locals>.<listcomp>z7Unable to join %d threads during a period of %d minutescSr.r	r/r0r	r	r
r3�r4zUnable to join %d threads)�faulthandler�list�start�appendr�verbose�printrrr#rr)�maxZdump_traceback�sys�stdoutr$)�threadsZunlockr5�startedr2�endtimer%r	r	r
�
start_threadsus����
�����
���rAc@s.eZdZ	dd�Zdd�Zdd�Zdd�Zd	S)
�catch_threading_exceptioncCs"d|_d|_d|_d|_d|_dSr)�exc_type�	exc_value�
exc_tracebackr�	_old_hook��selfr	r	r
�__init__�s

z"catch_threading_exception.__init__cCs$|j|_|j|_|j|_|j|_dSr)rCrDrEr)rHrr	r	r
�_hook�szcatch_threading_exception._hookcCstj|_|jt_|Sr)r�
excepthookrFrJrGr	r	r
�	__enter__�sz#catch_threading_exception.__enter__cGs|jt_|`|`|`|`dSr)rFrrKrCrDrEr)rH�exc_infor	r	r
�__exit__�s
z"catch_threading_exception.__exit__N)�__name__�
__module__�__qualname__rIrJrLrNr	r	r	r
rB�srBr)r�
contextlibrr<rr�testrrrr �contextmanagerr(r+rArBr	r	r	r
�<module>s 
$%