Sindbad~EG File Manager

Current Path : /usr/local/lib/python3.9/test/__pycache__/
Upload File :
Current File : //usr/local/lib/python3.9/test/__pycache__/fork_wait.cpython-39.opt-1.pyc

a

��g��@sZdZddlZddlZddlZddlZddlZddlmZdZdZ	dZ
Gdd�dej�ZdS)	arThis test case provides support for checking forking and wait behavior.

To test different wait behavior, override the wait_impl method.

We want fork1() semantics -- only the forking thread survives in the
child after a fork().

On some systems (e.g. Solaris without posix threads) we find that all
active threads survive in the child after a fork(); this is an error.
�N)�support�g�?�c@s4eZdZdd�Zdd�Zdd�Zdd�Zd	d
�ZdS)�ForkWaitcCs t��|_i|_d|_g|_dS)Nr)rZthreading_setup�_threading_key�alive�stop�threads)�self�r�*/usr/local/lib/python3.9/test/fork_wait.py�setUps
zForkWait.setUpcCs8d|_|jD]}|��qd}|j��tj|j�dS)N�)rr	�join�clearrZthreading_cleanupr)r
�threadrrr�tearDowns


zForkWait.tearDowncCs<|js8t��|j|<zt�t�Wqty4Yq0qdS)N)r�os�getpidr�time�sleep�
SHORTSLEEP�OSError)r
�idrrr�f&sz
ForkWait.fcCstj||d�dS)N��exitcode)rZwait_process)r
�cpidrrrr�	wait_impl.szForkWait.wait_implc	Cstt�D]*}tj|j|fd�}|��|j�|�qt�	�t
j}t|j
�tkrjt�d�|t�	�krBqjqBt|j
���}|�|ttt���|j
��}tjdvr�t��}nt��}|dkr�t�t�d}|j
D]}|j
|||kr�|d7}q�t�|�n|j|dd�dS)N)�target�argsg�������?)Z	unixware7rrr)�range�NUM_THREADS�	threading�Threadr�startr	�appendr�	monotonicrZ
SHORT_TIMEOUT�lenrr�sorted�keysZassertEqual�list�copy�sys�platformrZfork1�fork�	LONGSLEEP�_exitr)	r
�ir�deadline�aZ
prefork_livesr�n�keyrrr�	test_wait1s.






zForkWait.test_waitN)�__name__�
__module__�__qualname__r
rrrr7rrrrrs
	r)
�__doc__rr-rZunittestr#�testrr0rr"ZTestCaserrrrr�<module>s 

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists