Sindbad~EG File Manager

Current Path : /usr/local/lib/python3.9/test/__pycache__/
Upload File :
Current File : //usr/local/lib/python3.9/test/__pycache__/test_fork1.cpython-39.opt-1.pyc

a

��g��@s�dZddlZddlZddlZddlZddlZddlZddlZddl	m
Z
ddlmZe�
ed�Gdd�de
�Zdd	�Zed
kr�e��dS)z.This test checks for correct fork() behavior.
�N)�ForkWait)�support�forkc@seZdZdd�Zdd�ZdS)�ForkTestcs�t���d�d�d�����fdd�}tj|d�}|�����d}t��}z~|s�t��}|�krpt�|�q�t	j
dkr�td	�t�d�n|��|j
||d
�Wzt�|tj�Wq�ty�Yq�0n(zt�|tj�Wnty�Yn00dS)zFCheck fork() in main thread works while a subthread is doing an importzfake test module�partialZcompletecs:t���tj�<���t�d��tj�<t��dS)Ng{�G�z�?)�imp�acquire_lock�sys�modules�set�time�sleep�release_lock��Zcomplete_moduleZfake_module_nameZimport_startedZpartial_moduler�+/usr/local/lib/python3.9/test/test_fork1.py�importers


z9ForkTest.test_threaded_import_lock_fork.<locals>.importer)�target�*�z Child encountered partial module��exitcodeN)�	threading�Event�Thread�start�wait�osr�
__import__�_exitr�verbose�print�join�	wait_impl�kill�signal�SIGKILL�OSError)�selfr�tr�pid�mrrr�test_threaded_import_lock_forks8
�z'ForkTest.test_threaded_import_lock_forkcs,d���fdd�}td�D]}||�qdS)zJCheck fork() in main thread works while the main thread is doing an importrc	s�d}d}zdzFt|�D]}t��|d7}qt��}|}Wt|�D]}t��qBnt|�D]}t��qZ0Wn4ty�|r�tjdkr�t	d�t�
d��Yn0|r�t�
���j|�d�dS)NrFrzRuntimeError in childr)�rangerrrrr�RuntimeErrorrr r!rr#)�level�releaseZin_child�ir*�rr(rr�fork_with_import_lockCs,
�


zDForkTest.test_nested_import_lock_fork.<locals>.fork_with_import_lock�N)r-)r(r3r/rr2r�test_nested_import_lock_fork?sz%ForkTest.test_nested_import_lock_forkN)�__name__�
__module__�__qualname__r,r5rrrrrs+rcCst��dS)N)r�
reap_childrenrrrr�tearDownModule`sr:�__main__)�__doc__�_imprrr%r	rrZunittestZtest.fork_waitr�testrZ
get_attributerr:r6�mainrrrr�<module>sM

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists