HEX
Server: Apache
System: Linux zacp120.webway.host 4.18.0-553.50.1.lve.el8.x86_64 #1 SMP Thu Apr 17 19:10:24 UTC 2025 x86_64
User: govancoz (1003)
PHP: 8.3.26
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: //usr/local/lib/python3.7/test/__pycache__/fork_wait.cpython-37.opt-1.pyc
B

��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�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�*/usr/local/lib/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�iZspid�statusrrr�	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%r9rrrrrs
	r)
�__doc__rr1rZunittestr)Ztest.supportrr4rr(ZTestCaserrrrr�<module>
s