Your IP : 216.73.216.196


Current Path : /opt/alt/python310/lib64/python3.10/test/__pycache__/
Upload File :
Current File : //opt/alt/python310/lib64/python3.10/test/__pycache__/fork_wait.cpython-310.opt-1.pyc

o

0�i��@sfdZddlZddlZddlZddlZddlZddlmZddlm	Z	dZ
dZdZGdd	�d	ej
�ZdS)
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)�threading_helper�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�5/opt/alt/python310/lib64/python3.10/test/fork_wait.py�setUps

zForkWait.setUpcCs8d|_|jD]}|��qd}|j��tj|j�dS)N�)r	r
�join�clearrZthreading_cleanupr)r�threadrrr
�tearDowns


zForkWait.tearDowncCsD|js t��|j|<zt�t�Wn	tyYnw|jrdSdS)N)r	�os�getpidr�time�sleep�
SHORTSLEEP�OSError)r�idrrr
�f's��z
ForkWait.fcCstj||d�dS)N��exitcode)rZwait_process)r�cpidrrrr
�	wait_impl/szForkWait.wait_implc	Cstt�D]}tj|j|fd�}|��|j�|�qt�	�t
j}t|j
�tkr;t�d�|t�	�kr4nt|j
�tks(t|j
���}|�|ttt���|j
��}tjdvr[t��}nt��}|dkr�t�t�d}|j
D]}|j
|||kr||d7}qmt�|�dS|j|dd�dS)N)�target�argsg�������?)Z	unixware7rrr)�range�NUM_THREADS�	threadingZThreadr�startr
�appendr�	monotonicrZ
SHORT_TIMEOUT�lenrr�sorted�keysZassertEqual�list�copy�sys�platformrZfork1�fork�	LONGSLEEP�_exitr)	r�irZdeadline�aZ
prefork_livesr�n�keyrrr
�	test_wait2s2
�




�zForkWait.test_waitN)�__name__�
__module__�__qualname__rrrrr6rrrr
rs	r)�__doc__rr-rZunittestr$�testrZtest.supportrr0rr#ZTestCaserrrrr
�<module>s