ó
wŰjc           @   sp   d  d l  m Z d  d l Z d  d l Z d  d l Z d e j f d     YZ d   Z e	 d k rl e   n  d S(   i˙˙˙˙(   t   test_supportNt   DummyThreadingTestCasec           B   s3   e  Z d  e j f d     YZ d   Z d   Z RS(   t
   TestThreadc           B   s   e  Z d    Z RS(   c         C   sÜ   d } t  j r* d G|  j Gd G| Gd GHn  t j   t j   t d 7a t  j r] t Gd GHn  t j   t j	 |  t  j r d G|  j Gd GHn  t j   t d 8a t  j rÄ |  j Gd Gt Gd GHn  t j   t j   d  S(	   Ni    t   tasks   will run fort   seci   s   tasks are runningt   dones   is finished.(
   R    t   verboset   namet   semat   acquiret   mutext   runningt   releaset   timet   sleep(   t   selft   delay(    (    s   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_dummy_threading.pyt   run
   s$    	


	
	

	
(   t   __name__t
   __module__R   (    (    (    s   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_dummy_threading.pyR      s   c         C   s:   d |  _  t j d d  a t j   a d a g  |  _ d  S(   Ni
   t   valuei   i    (   t   numtaskst
   _threadingt   BoundedSemaphoreR   t   RLockR
   R   t   threads(   R   (    (    s   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_dummy_threading.pyt   setUp$   s
    	c         C   s   xG t  |  j  D]6 } |  j d d |  } |  j j |  | j   q Wt j r[ d GHn  x |  j D] } | j   qe Wt j r d GHn  d  S(   NR   s   <thread %d>s!   waiting for all tasks to completes   all tasks done(	   t   rangeR   R   R   t   appendt   startR    R   t   join(   R   t   it   t(    (    s   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_dummy_threading.pyt
   test_tasks.   s    		(   R   R   R   t   ThreadR   R   R!   (    (    (    s   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_dummy_threading.pyR      s   	
c           C   s   t  j t  d  S(   N(   R    t   run_unittestR   (    (    (    s   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_dummy_threading.pyt	   test_main;   s    t   __main__(
   t   testR    t   unittestt   dummy_threadingR   R   t   TestCaseR   R$   R   (    (    (    s   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_dummy_threading.pyt   <module>   s   5	