HEX
Server: Apache
System: Linux opal14.opalstack.com 3.10.0-1160.108.1.el7.x86_64 #1 SMP Thu Jan 25 16:17:31 UTC 2024 x86_64
User: curbgloabal_opal (1234)
PHP: 8.1.29
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //lib64/python3.6/test/__pycache__/fork_wait.cpython-36.pyc
3


 \=
�@sZdZddlZddlZddlZddlZddljZejd�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�	threading�g�?�c@s4eZdZdd�Zdd�Zdd�Zdd�Zd	d
�ZdS)�ForkWaitcCs tj�|_i|_d|_g|_dS)Nr)�supportZthreading_setup�_threading_key�alive�stop�threads)�self�r�!/usr/lib64/python3.6/fork_wait.py�setUps
zForkWait.setUpcCs<d|_x|jD]}|j�qWd}|jj�tj|j�dS)N�)r	r
�join�clearrZthreading_cleanupr)r�threadrrr
�tearDowns
zForkWait.tearDowncCsBx<|js<tj�|j|<ytjt�Wqtk
r8YqXqWdS)N)r	�os�getpidr�time�sleep�
SHORTSLEEP�OSError)r�idrrr
�f&sz
ForkWait.fcCsjx:td�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_implc	Csx6tt�D]*}tj|j|fd�}|j�|jj|�q
Wtj	�d}x*t
|j�tkrntjd�|tj	�krFPqFWt
|jj��}|j|ttt���|jj�}tjdkr�tj�}ntj�}|dk�rtjt�d}x(|jD]}|j|||kr�|d7}q�Wtj|�n
|j|�dS)N)�target�argsg$@g�������?�	unixware7rr)r()r�NUM_THREADSrZThreadr�startr
�appendrZ	monotonic�lenrr�sorted�keysr"�list�copy�sys�platformrZfork1�fork�	LONGSLEEP�_exitr%)	rr$rZdeadline�aZ
prefork_livesr#�n�keyrrr
�	test_wait:s.





zForkWait.test_waitN)�__name__�
__module__�__qualname__rrrr%r9rrrr
rs
	r)�__doc__rr1rZunittestZtest.supportr�
import_modulerr4rr)ZTestCaserrrrr
�<module>
s