Current File : //snap/core22/current/lib/python3.10/test/support/__pycache__/threading_helper.cpython-310.pyc |
o
E�h� � @ s� d dl Z d dlZd dlZd dlZd dlZd dlZd dlmZ dd� Zdd� Z dd� Z
ejdd d
��Zddd�Z
ejdd
d��ZG dd� d�ZdS )� N)�supportc C s t �� tj�� fS �N)�_thread�_count� threading� _dangling�copy� r r �4/usr/lib/python3.10/test/support/threading_helper.py�threading_setup s r c
G s� d}t |�D ]L}t�� tjf}|| kr d S |sGdt_|d }t�d|d | d � d|d � dt|�� d�� |D ]
}t�d |��� q:d }d }t �
d
� t�� qd S )N�d T� z&threading_cleanup() failed to cleanup r z threads (count: z, dangling: �)zDangling thread: �{�G�z�?)�ranger r r r r �environment_altered�
print_warning�len�time�sleep�
gc_collect)�original_values�
_MAX_COUNT�count�values�dangling_threads�threadr r r
�threading_cleanup s, ��
�
�r c s t �� �� fdd��}|S )z�Use this function when threads are being used. This will
ensure that the threads are cleaned up even when the test fails.
c s$ t � }z � | � W t|� S t|� w r )r r )�args�key��funcr r
� decorator: s zreap_threads.<locals>.decorator)� functools�wraps)r! r"