Your IP : 216.73.216.213


Current Path : /opt/alt/python34/lib64/python3.4/test/__pycache__/
Upload File :
Current File : //opt/alt/python34/lib64/python3.4/test/__pycache__/test_dummy_threading.cpython-34.pyc

�
f f�@ssddlmZddlZddlZddlZGdd�dej�Zdd�Ze	dkroe�ndS)�)�supportNc@sAeZdZGdd�dej�Zdd�Zdd�ZdS)�DummyThreadingTestCasec@seZdZdd�ZdS)z!DummyThreadingTestCase.TestThreadcCs�d}tjr+td|jd|d�ntj�tj�td7atjrbttd�ntj�t	j
|�tjr�td|jd�ntj�td8atjr�t|jdtd�ntj�tj�dS)	NrZtaskzwill run forZsec�ztasks are running�donezis finished.)r�verbose�print�name�sema�acquire�mutex�running�release�timeZsleep)�selfZdelay�r�>/opt/alt/python34/lib64/python3.4/test/test_dummy_threading.py�run
s$	


	

	

	
z%DummyThreadingTestCase.TestThread.runN)�__name__�
__module__�__qualname__rrrrr�
TestThreadsrcCs:d|_tjdd�atj�adag|_dS)N�
�value�r)�numtasks�
_threadingZBoundedSemaphorer	�RLockrr�threads)rrrr�setUp$s
	zDummyThreadingTestCase.setUpcCs�xGt|j�D]6}|jdd|�}|jj|�|j�qWtjr`td�nx|jD]}|j	�qjWtjr�td�ndS)Nrz<thread %d>z!waiting for all tasks to completezall tasks done)
�rangerrr�append�startrrr�join)r�i�trrr�
test_tasks.s	
	z!DummyThreadingTestCase.test_tasksN)rrrrZThreadrrr%rrrrrs
rcCstjt�dS)N)rZrun_unittestrrrrr�	test_main;sr&�__main__)
ZtestrZunittestZdummy_threadingrrZTestCaserr&rrrrr�<module>s5