Your IP : 216.73.216.85


Current Path : /opt/alt/python35/lib64/python3.5/test/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib64/python3.5/test/__pycache__/fork_wait.cpython-35.opt-1.pyc



��Yf(	�@s�dZddlZddlZddlZddlZddljZejd�ZdZ	dZ
dZGdd�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�_thread�g�?�c@sIeZdZdd�Zdd�Zdd�Zejdd��Zd	S)
�ForkWaitcCsi|_d|_dS)Nr)�alive�stop)�self�r	�3/opt/alt/python35/lib64/python3.5/test/fork_wait.py�setUps	zForkWait.setUpcCsMxF|jsHtj�|j|<ytjt�Wqtk
rDYqXqWdS)N)r�os�getpidr�time�sleep�
SHORTSLEEP�OSError)r�idr	r	r
�fs
z
ForkWait.fcCs�xMtd�D]?}tj|tj�\}}||kr;Ptjdt�q
W|j||�|j|dd|d@|d?f�dS)N�
rrzcause = %d, exit = %d��)�ranger�waitpid�WNOHANGrrr�assertEqual)r�cpid�iZspidZstatusr	r	r
�	wait_impl"szForkWait.wait_implcCsix*tt�D]}tj|j|f�q
Wtj�d}x9t|j�tkrxtj	d�|tj�kr@Pq@Wt
|jj��}|j|t
tt���|jj�}tjdkr�tj�}ntj�}|dkrGtj	t�d}x2|jD]'}|j|||kr|d7}qWtj|�nz|j|�Wdd|_XdS)Ng$@g�������?�	unixware7r�)r)r�NUM_THREADSr�	start_newrrZ	monotonic�lenrr�sorted�keysr�list�copy�sys�platformrZfork1�fork�	LONGSLEEP�_exitrr)rrZdeadline�aZ
prefork_livesr�n�keyr	r	r
�	test_wait.s.

zForkWait.test_waitN)	�__name__�
__module__�__qualname__rrr�supportZreap_threadsr/r	r	r	r
rsr)�__doc__rr'rZunittestZtest.supportr3�
import_modulerr*rr ZTestCaserr	r	r	r
�<module>
s0