Your IP : 216.73.217.129


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



���]��@s�ddlZddlZddlZddlZddlZddlZddlmZddl	m
Z
mZmZm
Z
ed�Zeed�Gdd�de�Zdd	�Zed
kr�ej�dS)�N)�ForkWait)�
reap_children�
get_attribute�
import_module�verbose�	threading�forkc@s4eZdZdd�Zdd�Zdd�ZdS)�ForkTestcCs�tj�d}xKtj�|kr]tj|tj�\}}||krMPtjd�qW|j||�|j|dd|d@|d?f�dS)Ng$@g�������?rzcause = %d, exit = %d��)�time�	monotonic�os�waitpid�WNOHANG�sleepZassertEqual)�selfZcpid�deadlineZspid�status�r�//opt/alt/python35/lib64/python3.5/test_fork1.py�	wait_implszForkTest.wait_implcstj��d�d�d�����fdd�}tjd|�}|j��j�tj�}zo|s�t��}|�kr�tjd�q�t	dkr�t
d	�tjd�n|j�|j|�Wdytj
|tj�Wntk
rYnXXdS)
Nzfake test module�partialZcompletecsItj��tj�<�j�tjd��tj�<tj�dS)Ng{�G�z�?)�imp�acquire_lock�sys�modules�setrr�release_lockr)�complete_module�fake_module_name�import_started�partial_modulerr�importer(s




z9ForkTest.test_threaded_import_lock_fork.<locals>.importer�targetr�z Child encountered partial module)r�Event�Thread�start�waitrr�
__import__�_exitr�print�joinr�kill�signal�SIGKILL�OSError)rr#�t�pid�mr)rr r!r"r�test_threaded_import_lock_fork"s.




z'ForkTest.test_threaded_import_lock_forkcs7�fdd�}xtd�D]}||�qWdS)Ncs�d}d}ykzBx(t|�D]}tj�|d7}qWtj�}|}Wdxt|�D]}tj�qaWXWn>tk
r�|r�tdkr�td�tj	d��YnX|r�tj	d��j
|�dS)NrFr%zRuntimeError in child)�rangerrrrr�RuntimeErrorrr,r+r)�level�releaseZin_child�ir3)rrr�fork_with_import_lockOs(




zDForkTest.test_nested_import_lock_fork.<locals>.fork_with_import_lock�)r6)rr;r8r)rr�test_nested_import_lock_forkLsz%ForkTest.test_nested_import_lock_forkN)�__name__�
__module__�__qualname__rr5r=rrrrr	s
*r	cCst�dS)N)rrrrr�tearDownModulelsrA�__main__)�_imprrr/rrZunittestZtest.fork_waitrZtest.supportrrrrrr	rAr>�mainrrrr�<module>s"
X