Sindbad~EG File Manager
�
SԚg� � �� � d Z ddlZddlZddlZddlZddlmZmZ ddlZddl Z ddl
Z
ddlmZ ddl
mZ e j ej d� � Zd� Z G d� d e� � Z G d
� de j � � Z G d� d
e� � Z G d� de� � Z G d� de� � Z G d� de� � Z G d� de� � Z G d� de� � Z G d� de� � Z G d� de� � Z G d� de� � ZdS )z/
Various tests for synchronization primitives.
� N)�start_new_thread�TIMEOUT_MAX)�support)�threading_helperz9platform doesn't support fork (no _at_fork_reinit method)c �4 � t j d| z � � d S )N�{�G�z�?)�time�sleep)�nthreads �,/usr/local/lib/python3.11/test/lock_tests.py�wait_threads_blockedr
s � � �J�u�w������� c �2 � e Zd ZdZd d�Zd� Zd� Zd� Zd� ZdS )
�Bunchz
A bunch of threads.
Fc �j � || _ || _ g | _ g | _ g | _ | | _ d| _ dS )z�
Construct a bunch of `nthread` threads running the same function `func`.
If `wait_before_exit` is True, the threads won't terminate until
do_finish() is called.
N)�funcr �started�finished�
exceptions� _can_exit�_wait_thread)�selfr r �wait_before_exits r �__init__zBunch.__init__! s? � � �� ���������
����-�-��� ����r c �
� t j � � }| j � |� � | � � � n1# t
$ r$}| j � |� � Y d }~nd }~ww xY w| j � |� � t j t j
� � D ]}| j r d S �
d S # | j � |� � t j t j
� � D ]}| j r w �w xY w�N)� threading� get_identr �appendr �
BaseExceptionr r r �sleeping_retry�
SHORT_TIMEOUTr )r �tid�exc�_s r �taskz
Bunch.task/ s% � ��!�#�#������C� � � � ��I�I�K�K�K�K��� (� (� (��O�"�"�3�'�'�'�'�'�'�'�'����� (����
�M� � ��%�%�%��+�G�,A�B�B�
�
���>� ��E�E��
�
��
�M� � ��%�%�%��+�G�,A�B�B�
�
���>� ��E��
���s0 �A �B<