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_dummy_threading.cpython-35.opt-2.pyc



���]��@sgddlmZddlZddlZddlZGdd�dej�Zedkrcej	�dS)�)�supportNc@sAeZdZGdd�dej�Zdd�Zdd�ZdS)�DummyThreadingTestCasec@seZdZdd�ZdS)z!DummyThreadingTestCase.TestThreadcCs�d}tjr(td|jd|d�tj�tj�td7atjr\ttd�tj�t	j
|�tjr�td|jd�tj�td8atjr�t|jdtd�tj�tj�dS)	NrZtaskzwill run forZsec�ztasks are running�donezis finished.)r�verbose�print�name�sema�acquire�mutex�running�release�time�sleep)�self�delay�r�9/opt/alt/python35/lib64/python3.5/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�
_threading�BoundedSemaphorer	�RLockrr�threads)rrrr�setUp$s
	zDummyThreadingTestCase.setUpcCs�xGt|j�D]6}|jdd|�}|jj|�|j�qWtjr]td�x|jD]}|j	�qgWtjr�td�dS)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)rrrr�Threadrr!r(rrrrrs
r�__main__)
ZtestrZunittest�dummy_threadingrrZTestCaserr�mainrrrr�<module>s5