Your IP : 216.73.216.213


Current Path : /opt/alt/python38/lib64/python3.8/test/__pycache__/
Upload File :
Current File : //opt/alt/python38/lib64/python3.8/test/__pycache__/test_dummy_threading.cpython-38.pyc

U

i�f��@sJddlmZddlZddlZddlZGdd�dej�ZedkrFe�	�dS)�)�supportNc@s.eZdZGdd�dej�Zdd�Zdd�ZdS)�DummyThreadingTestCasec@seZdZdd�ZdS)z!DummyThreadingTestCase.TestThreadcCs�d}tjrtd|jd|d�t��t��td7atjrDttd�t��t	�
|�tjrjtd|jd�t��td8atjr�t|jdtd�t��t��dS)	NrZtaskzwill run forZsec�ztasks are runningZdonezis finished.)r�verbose�print�name�sema�acquire�mutex�running�release�time�sleep)�selfZdelay�r�>/opt/alt/python38/lib64/python3.8/test/test_dummy_threading.py�run
s$

z%DummyThreadingTestCase.TestThread.runN)�__name__�
__module__�__qualname__rrrrr�
TestThreadsrcCs(d|_tjdd�at��adag|_dS)N�
�)�valuer)�numtasks�
_threadingZBoundedSemaphorer�RLockr
r�threads)rrrr�setUp$s
zDummyThreadingTestCase.setUpcCsht|j�D](}|jd|d�}|j�|�|��q
tjrBtd�|jD]}|�	�qHtjrdtd�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_threadingrr
ZTestCaserr�mainrrrr�<module>s5