Your IP : 216.73.216.60


Current Path : /opt/alt/python36/lib64/python3.6/test/__pycache__/
Upload File :
Current File : //opt/alt/python36/lib64/python3.6/test/__pycache__/test_dummy_threading.cpython-36.opt-2.pyc

3

��2a��@sJddlmZddlZddlZddlZGdd�dej�ZedkrFej	�dS)�)�supportNc@s.eZdZGdd�dej�Zdd�Zdd�ZdS)�DummyThreadingTestCasec@seZdZdd�ZdS)z!DummyThreadingTestCase.TestThreadcCs�d}tjrtd|jd|d�tj�tj�td7atjrDttd�tj�t	j
|�tjrjtd|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�timeZsleep)�selfZdelay�r�9/opt/alt/python36/lib64/python3.6/test_dummy_threading.py�run
s$

z%DummyThreadingTestCase.TestThread.runN)�__name__�
__module__�__qualname__rrrrr�
TestThreadsrcCs(d|_tjdd�atj�adag|_dS)N�
�)�valuer)�numtasks�
_threadingZBoundedSemaphorer	�RLockrr�threads)rrrr�setUp$s
zDummyThreadingTestCase.setUpcCspx6t|j�D](}|jd|d�}|jj|�|j�qWtjrFtd�x|jD]}|j	�qNWtjrltd�dS)Nz<thread %d>)rz!waiting for all tasks to completezall tasks done)
�rangerrr�append�startrrr�join)r�i�trrr�
test_tasks.sz!DummyThreadingTestCase.test_tasksN)rrrrZThreadrrr%rrrrrs
r�__main__)
ZtestrZunittestZdummy_threadingrrZTestCaserr�mainrrrr�<module>s5