Sindbad~EG File Manager
�
&Μg�� � � � d Z ddlZddlZddlZddlmZmZ ddlZddlZddl Z ddl
mZ ddlm
Z
ej ej d� Zd� Z G d� d e� Z G d
� dej( � 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� Zy)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 � y )N�{�G�z�?)�time�sleep)�nthreads �,/usr/local/lib/python3.12/test/lock_tests.py�wait_threads_blockedr
s � � �J�J�u�w��� c �0 � e Zd ZdZdd�Zd� Zd� Zd� Zd� Zy) �Bunchz
A bunch of threads.
c �h � || _ || _ g | _ g | _ g | _ | | _ d| _ y)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__ s9 � � �� ���������
����-�-��� ��r c �4 � t j � }| j j |� | j � | j j |� t j t j � D ] }| j s� y y # t
$ r%}| j j |� Y d }~�{d }~ww xY w# | j j |� t j t j � D ] }| j s� 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�
�M�M� � ��%��+�+�G�,A�,A�B���>�>�� C�� � (��O�O�"�"�3�'�'�� (��
�M�M� � ��%��+�+�G�,A�,A�B���>�>�� C�s0 �B � C�B<�7C �<C�C �AD�Dc � � t j t j � | _ | j j � t
| j � D ] }t | j d� � t j t j � D ]'