Your IP : 216.73.216.196


Current Path : /opt/alt/python37/lib64/python3.7/test/__pycache__/
Upload File :
Current File : //opt/alt/python37/lib64/python3.7/test/__pycache__/fork_wait.cpython-37.pyc

B

� f
�@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�g�?�c@s4eZdZdd�Zdd�Zdd�Zdd�Zd	d
�ZdS)�ForkWaitcCs t��|_i|_d|_g|_dS)Nr)�supportZthreading_setup�_threading_key�alive�stop�threads)�self�r�3/opt/alt/python37/lib64/python3.7/test/fork_wait.py�setUps
zForkWait.setUpcCs<d|_x|jD]}|��qWd}|j��tj|j�dS)N�)rr	�join�clearrZthreading_cleanupr)r
�threadrrr�tearDowns
zForkWait.tearDowncCsBx<|js<t��|j|<yt�t�Wqtk
r8YqXqWdS)N)r�os�getpidr�time�sleep�
SHORTSLEEP�OSError)r
�idrrr�f&sz
ForkWait.fcCsjx:td�D].}t�|tj�\}}||kr*Pt�dt�q
W|�||�|�|dd|d@|d?f�dS)N�
rrzcause = %d, exit = %d��)�ranger�waitpid�WNOHANGrrr�assertEqual)r
�cpid�iZspidZstatusrrr�	wait_impl.szForkWait.wait_implc	Csx6tt�D]*}tj|j|fd�}|��|j�|�q
Wt�	�d}x*t
|j�tkrnt�d�|t�	�krFPqFWt
|j���}|�|ttt���|j��}tjdkr�t��}nt��}|dk�rt�t�d}x(|jD]}|j|||kr�|d7}q�Wt�|�n
|�|�dS)N)�target�argsg$@g�������?)Z	unixware7rr)r�NUM_THREADS�	threadingZThreadr�startr	�appendrZ	monotonic�lenrr�sorted�keysr!�list�copy�sys�platformrZfork1�fork�	LONGSLEEP�_exitr$)	r
r#rZdeadline�aZ
prefork_livesr"�n�keyrrr�	test_wait:s.





zForkWait.test_waitN)�__name__�
__module__�__qualname__r
rrr$r8rrrrrs
	r)
�__doc__rr0rZunittestr(Ztest.supportrr3rr'ZTestCaserrrrr�<module>
s