3 Ø ÷^Îpc@sdZddlZddlZddlmZmZddlZddlZddlZddl m Z dd„Z Gdd„de ƒZ Gd d „d ejƒZGd d „d eƒZGd d„deƒZGdd„deƒZGdd„deƒZGdd„deƒZGdd„deƒZGdd„deƒZGdd„deƒZGdd„deƒZdS)z/ Various tests for synchronization primitives. éN)Ústart_new_threadÚ TIMEOUT_MAX)ÚsupportcCstjdƒdS)Nç{®Gáz„?)ÚtimeÚsleep©rrú'/usr/lib64/python3.6/test/lock_tests.pyÚ_waitsr c@s2eZdZdZd dd„Zdd„Zdd„Zd d „Zd S) ÚBunchz A bunch of threads. Fc s|ˆˆ_|ˆ_gˆ_gˆ_| ˆ_tjƒˆ_ˆjjƒ‡‡fdd„}y xt |ƒD]}t |fƒqNWWndˆ_‚YnXdS)z¹ Construct a bunch of `n` threads running the same function `f`. If `wait_before_exit` is True, the threads won't terminate until do_finish() is called. c sDtjƒ}ˆjj|ƒz ˆƒWdˆjj|ƒxˆjs.taskTN) rÚnr rrrÚwait_threads_exitÚ wait_threadZ __enter__Úranger)rrrZwait_before_exitrÚirrrÚ__init__s   zBunch.__init__cCs xt|jƒ|jkrtƒqWdSr )Úlenr rr ©rrrrÚwait_for_started6ózBunch.wait_for_startedcCs0xt|jƒ|jkrtƒqW|jjdddƒdSr )rrrr rZ__exit__rrrrÚwait_for_finished:s zBunch.wait_for_finishedcCs d|_dS©NT)rrrrrÚ do_finish@ózBunch.do_finishN)F)Ú__name__Ú __module__Ú __qualname__Ú__doc__rrrr!rrrrr s  r c@s$eZdZdd„Zdd„Zdd„ZdS)Ú BaseTestCasecCstjƒ|_dSr )rZthreading_setupÚ_threadsrrrrÚsetUpEr"zBaseTestCase.setUpcCstj|jŽtjƒdSr )rZthreading_cleanupr(Z reap_childrenrrrrÚtearDownHs zBaseTestCase.tearDowncCs$|j||dƒ|j||dƒdS)Ng333333ã?g$@)ZassertGreaterEqualÚ assertLess)rZactualZexpectedrrrÚ assertTimeoutLszBaseTestCase.assertTimeoutN)r#r$r%r)r*r,rrrrr'Dsr'c@sxeZdZdZdd„Zdd„Zdd„Zdd „Zd d „Zd d „Z dd„Z dd„Z dd„Z dd„Z dd„Zdd„Zdd„ZdS)Ú BaseLockTestsz; Tests for both recursive and non-recursive locks. cCs|jƒ}~dSr )Úlocktype©rÚlockrrrÚtest_constructorZózBaseLockTests.test_constructorcCs|jƒ}|jt|ƒdƒ~dS)Nz)r.Ú assertRegexÚreprr/rrrÚ test_repr^ózBaseLockTests.test_reprcCs&|jƒ}|jƒ|jt|ƒdƒ~dS)Nz)r.Úacquirer3r4r/rrrÚtest_locked_reprcszBaseLockTests.test_locked_reprcCó|jƒ}|jƒ~dSr )r.r7r/rrrÚtest_acquire_destroyióz"BaseLockTests.test_acquire_destroycCs|jƒ}|jƒ|jƒ~dSr ©r.r7Úreleaser/rrrÚtest_acquire_releasensz"BaseLockTests.test_acquire_releasecCs$|jƒ}|j|jdƒƒ|jƒdS©NF)r.Ú assertTruer7r=r/rrrÚtest_try_acquiretr6zBaseLockTests.test_try_acquirecsJ|jƒ‰ˆjƒg‰‡‡fdd„}t|dƒjƒ|jˆdƒˆjƒdS)NcsˆjˆjdƒƒdSr?©rr7r©r0Úresultrrr}r"z3BaseLockTests.test_try_acquire_contended..fér)r.r7r rÚ assertFalser=©rrrrCrÚtest_try_acquire_contendedysz(BaseLockTests.test_try_acquire_contendedcsp|jƒ‰ˆjƒd}‡fdd„}t||ƒ}|jƒtƒ|jt|jƒdƒˆjƒ|j ƒ|jt|jƒ|ƒdS)NécóˆjƒˆjƒdSr ©r7r=r©r0rrr‡r2z/BaseLockTests.test_acquire_contended..fr) r.r7r rr Ú assertEqualrrr=r©rÚNrÚbrrLrÚtest_acquire_contendedƒs  z$BaseLockTests.test_acquire_contendedcsV|jƒ‰‡fdd„}d‡fdd„ }|ƒt|dƒjƒ|jt|tƒt|dƒjƒdS)NcrJr rKrrLrrr•r2z"BaseLockTests.test_with..fc s ˆ|dk r|‚WdQRXdSr r©ZerrrLrrÚ_with˜sz&BaseLockTests.test_with.._withrEr )r.r rÚ assertRaisesÚ TypeError)rrrSrrLrÚ test_with“s zBaseLockTests.test_withcs`|jƒ‰‡fdd„}ttjƒƒ}t|dƒjƒttjƒƒ|kr\tjdƒ|j|ttjƒƒƒdS)NcrJr rKrrLrrr§r2z)BaseLockTests.test_thread_leak..figš™™™™™Ù?) r.rr Z enumerater rrrrM)rrrrrLrÚtest_thread_leak£s   zBaseLockTests.test_thread_leakcsÜ|jƒ‰|jtˆjddƒ|jtˆjd d|jtˆjdd|jtˆjtddˆjtdˆjƒtjƒ}|jˆjddƒtjƒ}|j ||dƒg‰‡‡fdd„}t |dƒj ƒ|j ˆdƒ|j ˆdd ƒdS) NrrEid©Útimeoutg}Ô%­I²TrIcs4tjƒ}ˆjˆjddƒtjƒ}ˆj||ƒdS)Nçà?rX)rrr7)Út1Út2©r0ÚresultsrrrÇsz%BaseLockTests.test_timeout..frZiœÿÿÿ)r.rTÚ ValueErrorr7Z OverflowErrorrr=rr@r+r rrFr,)rr[r\rrr]rÚ test_timeout¶s  zBaseLockTests.test_timeoutcCs"|jƒ}tj|ƒ}|j|ƒƒdSr )r.ÚweakrefÚrefZassertIsNotNone©rr0rbrrrÚtest_weakref_existsÐs z!BaseLockTests.test_weakref_existscCs$|jƒ}tj|ƒ}~|j|ƒƒdSr )r.rarbZ assertIsNonercrrrÚtest_weakref_deletedÕs z"BaseLockTests.test_weakref_deletedN)r#r$r%r&r1r5r8r:r>rArHrQrVrWr`rdrerrrrr-Us r-c@s(eZdZdZdd„Zdd„Zdd„ZdS) Ú LockTestszn Tests for non-recursive, weak locks (which can be acquired and released from different threads). c sš|jƒ‰g‰‡‡fdd„}tjƒnt|fƒxtˆƒdkrDtƒq0Wtƒ|jtˆƒdƒˆjƒxtˆƒdkrztƒqfW|jtˆƒdƒWdQRXdS)Ncs(ˆjƒˆjdƒˆjƒˆjdƒdSr )r7rr©r0Zphaserrræs z#LockTests.test_reacquire..frrEé)r.rrrrr rMr=rGrrgrÚtest_reacquireás    zLockTests.test_reacquirecsB|jƒ‰ˆjƒ‡fdd„}t|dƒ}|jƒˆjƒˆjƒdS)Ncó ˆjƒdSr )r=rrLrrrûr"z*LockTests.test_different_thread..frE)r.r7r rr=©rrrPrrLrÚtest_different_thread÷s  zLockTests.test_different_threadcCsN|jƒ}|jƒ|j|jddƒ|jƒ|j|jƒƒ|j|jddƒdS)NrrXF)Zblocking)r.r7rFr=Zlockedr@r/rrrÚtest_state_after_timeouts z"LockTests.test_state_after_timeoutN)r#r$r%r&rirlrmrrrrrfÜs rfc@s8eZdZdZdd„Zdd„Zdd„Zdd „Zd d „Zd S) Ú RLockTestsz$ Tests for recursive locks. cCs<|jƒ}|jƒ|jƒ|jƒ|jƒ|jƒ|jƒdSr r<r/rrrriszRLockTests.test_reacquirecCsX|jƒ}|jt|jƒ|jƒ|jƒ|jƒ|jƒ|jƒ|jƒ|jt|jƒdSr )r.rTÚ RuntimeErrorr=r7r/rrrÚtest_release_unacquiredóz"RLockTests.test_release_unacquiredcCsX|jƒ}|jt|jƒ|jƒ|jƒ|jƒ|jƒ|jƒ|jƒ|jt|jƒdSr )r.rTroZ _release_saver7r=r/rrrÚtest_release_save_unacquired&rqz'RLockTests.test_release_save_unacquiredc sJ|jƒ‰‡fdd„}t|ddƒ}z|jtˆjƒWd|jƒX|jƒdS)Ncrjr )r7rrLrrr5r"z+RLockTests.test_different_thread..frET)r.r rTror=r!rrkrrLrrl2s   z RLockTests.test_different_threadcs |jƒ‰|jˆjƒƒˆjƒ|jˆjƒƒˆjƒ|jˆjƒƒg‰‡‡fdd„}t|dƒjƒ|jˆdƒˆjƒ|jˆjƒƒˆjƒ|jˆjƒƒdS)NcsˆjˆjƒƒdSr )rÚ _is_ownedrrCrrrFr"z$RLockTests.test__is_owned..frEr)r.rFrsr7r@r rr=rGrrCrÚtest__is_owned>szRLockTests.test__is_ownedN) r#r$r%r&rirprrrlrtrrrrrn s     rnc@s@eZdZdZdd„Zdd„Zdd„Zdd „Zd d „Zd d „Z dS)Ú EventTestsz" Tests for Event objects. cCsr|jƒ}|j|jƒƒ|jƒ|j|jƒƒ|jƒ|j|jƒƒ|jƒ|j|jƒƒ|jƒ|j|jƒƒdSr )Ú eventtyperFZis_setÚsetr@Úclear©rÚevtrrrÚ test_is_setUszEventTests.test_is_setcs|d}g‰g‰‡‡‡fdd„}t||ƒ}|jƒtƒ|jtˆƒdƒˆjƒ|jƒ|jˆdg|ƒ|jˆdg|ƒdS)NrIcs ˆjˆjƒƒˆjˆjƒƒdSr ©rÚwaitr©rzÚresults1Úresults2rrrfsz#EventTests._check_notify..frT)r rr rMrrwr)rrzrOrrPrr~rÚ _check_notifyas zEventTests._check_notifycCs0|jƒ}|j|ƒ|jƒ|jƒ|j|ƒdSr )rvrrwrxryrrrÚ test_notifyrs  zEventTests.test_notifycs¼|jƒ‰g‰g‰d}‡‡‡fdd„}t||ƒjƒ|jˆdg|ƒx&ˆD]\}}|j|ƒ|j|dƒqJWg‰g‰ˆjƒt||ƒjƒ|jˆdg|ƒxˆD]\}}|j|ƒq¢WdS)NrIcs@ˆjˆjdƒƒtjƒ}ˆjdƒ}tjƒ}ˆj|||fƒdS)NgrZ)rr}r)r[Úrr\r~rrrs  z"EventTests.test_timeout..fFrZT)rvr rrMrFr,rwr@)rrOrrƒÚdtrr~rr`zs" zEventTests.test_timeoutcsn|jƒ‰g‰d‰d}‡‡‡fdd„}t||ƒ}|jƒtjˆƒˆjƒˆjƒ|jƒ|jˆdg|ƒdS)NgÐ?rIcsˆjˆjˆdƒƒdS©Nér|r©rzr^rYrrršr"z(EventTests.test_set_and_clear..fT) rvr rrrrwrxrrMrNrr‡rÚtest_set_and_clear“s  zEventTests.test_set_and_clearcCs\|jƒ}|j|j|jjdƒƒWdQRX|jƒ|j|j|jjdƒƒWdQRXdSr?)rvZ_condrFr7Z_reset_internal_locksryrrrÚtest_reset_internal_locks¤s z$EventTests.test_reset_internal_locksN) r#r$r%r&r{rr‚r`rˆr‰rrrrruPs ruc@sPeZdZdZdd„Zdd„Zdd„Zdd „Zd d „Zd d „Z dd„Z dd„Z dS)ÚConditionTestsz( Tests for condition variables. c Cs¦|jƒ}|jƒ|jƒ|jƒ|jƒtjƒ}|j|ƒ}|jƒ|j|jdƒƒ|jƒ|j|jdƒƒ|j|jdƒƒ|jƒ||j|jdƒƒWdQRXdSr?)Úcondtyper7r=r ZLockrFr@)rÚcondr0rrrÚ test_acquire³s zConditionTests.test_acquirecCó|jƒ}|jt|jƒdSr )r‹rTror}©rrŒrrrÚtest_unacquired_waitÆr2z#ConditionTests.test_unacquired_waitcCrŽr )r‹rTroÚnotifyrrrrÚtest_unacquired_notifyÊr2z%ConditionTests.test_unacquired_notifycsìd}g‰g‰g‰d‰‡‡‡‡‡fdd„}t||ƒ}|jƒxtˆƒdkrPtƒq.férETrhi©TrEr—©Trhr˜r—r˜r˜)Tr–) r rrr rxrMr7r‘r=Z notify_allr)rrŒrOrrPrr”rrÎsX            zConditionTests._check_notifycCs |jƒ}|j|ƒ|j|ƒdSr )r‹rrrrrr‚s zConditionTests.test_notifycsh|jƒ‰g‰d}‡‡fdd„}t||ƒjƒ|jtˆƒ|ƒx&ˆD]\}}|j|dƒ|j|ƒqBWdS)NrIcs@ˆjƒtjƒ}ˆjdƒ}tjƒ}ˆjƒˆj|||fƒdS)NrZ)r7rr}r=r)r[rDr\©rŒr^rrr"s  z&ConditionTests.test_timeout..frZ)r‹r rrMrr,rF)rrOrr„rDrr™rr`s zConditionTests.test_timeoutc svˆjƒ‰d‰‡‡‡fdd„}t|dƒ}|jƒx:tdƒD].}tjdƒˆˆd7‰ˆjƒWdQRXq8W|jƒdS)Nrc s<ˆ.ˆj‡fdd„ƒ}ˆj|ƒˆjˆdƒWdQRXdS)NcóˆdkSr…rr©ÚstaterrÚ9óz8ConditionTests.test_waitfor..f..r†)Úwait_forr@rMr“©rŒrrœrrr7s z&ConditionTests.test_waitfor..frEr†r)r‹r rrrrr‘r©rrrPrrr rÚ test_waitfor4s  zConditionTests.test_waitforc sŒˆjƒ‰d‰g‰‡‡‡‡fdd„}t|dƒ}|jƒx:tdƒD].}tjdƒˆˆd7‰ˆjƒWdQRXq>W|jƒˆjt ˆƒdƒdS)Nrc s^ˆPtjƒ}ˆj‡fdd„dd}tjƒ|}ˆj|ƒˆj|dƒˆjdƒWdQRXdS)Ncršr…rrr›rrrLržz@ConditionTests.test_waitfor_timeout..f..gš™™™™™¹?rX)rrŸrFr,r)r„rD©rŒrrœZsuccessrrrIs   z.ConditionTests.test_waitfor_timeout..frEr–r) r‹r rrrrr‘rrMrr¡rr£rÚtest_waitfor_timeoutEs  z#ConditionTests.test_waitfor_timeoutN) r#r$r%r&rrr’rr‚r`r¢r¤rrrrrŠ®sJrŠc@sXeZdZdZdd„Zdd„Zdd„Zdd „Zd d „Zd d „Z dd„Z dd„Z dd„Z dS)ÚBaseSemaphoreTestszB Common tests for {bounded, unbounded} semaphore objects. cCs,|jt|jdd|jt|jtj ddS)NrE)Zvalueiÿÿÿÿ)rTr_ÚsemtypeÚsysZmaxsizerrrrr1brz#BaseSemaphoreTests.test_constructorcCsH|jdƒ}|jƒ|jƒ|jdƒ}|jƒ|jƒ|jƒ|jƒdS)NrErh)r¦r7r=©rÚsemrrrrfs  zBaseSemaphoreTests.test_acquirecCr9r )r¦r7r¨rrrr:pr;z'BaseSemaphoreTests.test_acquire_destroycsŠ|jdƒ‰ˆjƒd}g‰g‰g‰d‰‡‡‡‡‡fdd„}t|dƒ}|jƒxtˆƒtˆƒdkrjtƒqNW|jˆˆdgdƒd‰xtdƒD] }ˆjƒqWxtˆƒtˆƒdkr¾tƒq¢W|jt ˆˆƒdgddgdƒd ‰xtdƒD] }ˆjƒqòWx"tˆƒtˆƒd kr$tƒqW|jt ˆˆƒdgddgdd gdƒ|j ˆjd ƒƒˆjƒ|j ƒ|jˆd gdƒdS)Néé rcs4ˆjˆjƒƒˆjˆƒˆjˆjƒƒˆjˆƒdSr rBr©r•rr€r©Z sem_resultsrrr}s z4BaseSemaphoreTests.test_acquire_contended..firEé rhéFTr­r®i) r¦r7r rrr rMrr=ÚsortedrFr)rrOrrPrrr¬rrQus:     $  .z)BaseSemaphoreTests.test_acquire_contendedcCsV|jdƒ}|j|jdƒƒ|j|jdƒƒ|j|jdƒƒ|jƒ|j|jdƒƒdS)NrhF)r¦r@r7rFr=r¨rrrrAšs  z#BaseSemaphoreTests.test_try_acquirecsV|jdƒ‰ˆjƒg‰‡‡fdd„}t|dƒjƒ|jtˆƒdgddgdƒdS) Nr†cs$ˆjˆjdƒƒˆjˆjdƒƒdSr?rBr©r^r©rrr¦sz8BaseSemaphoreTests.test_try_acquire_contended..frIFrªTr–)r¦r7r rrMr¯rGrr°rrH¢s  z-BaseSemaphoreTests.test_try_acquire_contendedcCs¤|jdƒ}|jt|jddd|j|jddƒ|j|jddƒ|j|jddƒ|jƒ|j|jddƒtjƒ}|j|jddƒtjƒ|}|j|dƒdS)NrhFçð?rXg{®Gázt?rZ) r¦rTr_r7r@rFr=rr,)rr©Ztr„rrrÚtest_acquire_timeout¯s  z'BaseSemaphoreTests.test_acquire_timeoutcsT|jƒ‰ˆjƒ‡fdd„}t|dƒ}|jƒtƒ|j|jƒˆjƒ|jƒdS)NcrJr rKr©r©rrrÀr2z0BaseSemaphoreTests.test_default_value..frE) r¦r7r rr rFrr=rrkrr³rÚtest_default_value¼s   z%BaseSemaphoreTests.test_default_valuecsbˆjdƒ‰d‡‡fdd„ }|ƒˆjˆjdƒƒˆjƒˆjt|tƒˆjˆjdƒƒˆjƒdS)NrhcsTˆFˆjˆjdƒƒˆjƒˆˆjˆjdƒƒ|r<|‚WdQRXWdQRXdSr?)r@r7r=rFrRr¨rrrSÌsz+BaseSemaphoreTests.test_with.._withFr )r¦r@r7r=rTrU)rrSrr¨rrVÊs zBaseSemaphoreTests.test_withN) r#r$r%r&r1rr:rQrArHr²r´rVrrrrr¥]s %  r¥c@óeZdZdZdd„ZdS)ÚSemaphoreTestsz) Tests for unbounded semaphores. cCs.|jdƒ}|jƒ|jƒ|jƒ|jƒdS©NrE)r¦r=r7r¨rrrrpàs  z&SemaphoreTests.test_release_unacquiredN©r#r$r%r&rprrrrr¶Ûór¶c@rµ)ÚBoundedSemaphoreTestsz' Tests for bounded semaphores. cCs8|jƒ}|jt|jƒ|jƒ|jƒ|jt|jƒdSr )r¦rTr_r=r7r¨rrrrpîs z-BoundedSemaphoreTests.test_release_unacquiredNr¸rrrrrºér¹rºc@sŠeZdZdZdZdZdd„Zdd„Zdd „Zd d „Z d"d d„Z dd„Z dd„Z dd„Z dd„Zdd„Zdd„Zdd„Zdd„Zdd „Zd!S)#Ú BarrierTestsz$ Tests for Barrier objects. rIg@cCs|j|j|jd|_dS)NrX)Ú barriertyperOÚdefaultTimeoutÚbarrierrrrrr)þr"zBarrierTests.setUpcCs|jjƒdSr )r¾Úabortrrrrr*r"zBarrierTests.tearDowncCs"t||jdƒ}|ƒ|jƒdSr·)r rOrrkrrrÚ run_threadsszBarrierTests.run_threadscCs®|jj}|j||jƒxtt|ƒD]h}|djdƒ|jt|dƒ||ƒ|jjƒ|djdƒ|jt|dƒ|d|ƒ|jjƒq W|j|jjdƒ|j |jj ƒdS)NrTrE) r¾ZpartiesrMrOrrrr}Ú n_waitingrFÚbroken)rr^rZmrrrrÚ multipasss zBarrierTests.multipassrEcs&ggg‰‡‡‡fdd„}ˆj|ƒdS)z; Test that a barrier is passed in lockstep csˆjˆˆƒdSr )rÃr©Úpassesr^rrrrr"z$BarrierTests.test_barrier..fN©rÀ)rrÅrrrÄrÚ test_barrierszBarrierTests.test_barriercCs |jdƒS)zC Test that a barrier works for 10 consecutive runs r«)rÇrrrrÚtest_barrier_10szBarrierTests.test_barrier_10cs:g‰‡‡fdd„}ˆj|ƒˆjtˆƒttˆjƒƒƒdS)z9 test the return value from barrier.wait csˆjjƒ}ˆj|ƒdSr )r¾r}r)rƒ©r^rrrr)s z(BarrierTests.test_wait_return..fN)rÀrMZsumrrOrGrrÉrÚtest_wait_return$s zBarrierTests.test_wait_returncs<g‰‡fdd„}ˆjˆj|ƒ‰‡‡‡fdd„}ˆj|ƒdS)z, Test the 'action' callback csˆjdƒdSr )rr)r^rrÚaction5r"z(BarrierTests.test_action..actioncsˆjƒˆjtˆƒdƒdSr·)r}rMrr©r¾r^rrrr8r2z#BarrierTests.test_action..fN©r¼rOrÀ)rrËrrrÌrÚ test_action0s  zBarrierTests.test_actioncsZg‰g‰‡‡‡fdd„}ˆj|ƒˆjtˆƒdƒˆjtˆƒˆjdƒˆjˆjjƒdS)zK Test that an abort will put the barrier in a broken state c svy4ˆjjƒ}|ˆjdkrt‚ˆjjƒˆjdƒWn<tjk rTˆjdƒYntk rpˆjjƒYnXdS©NrhT)r¾r}rOrorr ÚBrokenBarrierErrorr¿©r©rr€rrrrDs   z"BarrierTests.test_abort..frrEN)rÀrMrrOr@r¾rÂrGrrÒrÚ test_abort>s zBarrierTests.test_abortcsdg‰g‰g‰‡‡‡‡fdd„}ˆj|ƒˆjtˆƒdƒˆjtˆƒˆjdƒˆjtˆƒˆjƒdS)zL Test that a 'reset' on a barrier frees the waiting threads c s˜ˆjjƒ}|ˆjdkrFx ˆjjˆjdkr8tjdƒqWˆjjƒn:yˆjjƒˆjdƒWn tj k r~ˆjdƒYnXˆjjƒˆjdƒdS)NrhrEgü©ñÒMbP?T) r¾r}rOrÁrrÚresetrr rÐrÑ©rr€Úresults3rrrr]s    z"BarrierTests.test_reset..frrEN)rÀrMrrOrGrrÕrÚ test_resetVs zBarrierTests.test_resetcsrg‰g‰g‰ˆjˆjƒ‰‡‡‡‡‡fdd„}ˆj|ƒˆjtˆƒdƒˆjtˆƒˆjdƒˆjtˆƒˆjƒdS)zF Test that a barrier can be reset after being broken. c s®y4ˆjjƒ}|ˆjdkrt‚ˆjjƒˆjdƒWn<tjk rTˆjdƒYntk rpˆjjƒYnXˆjƒˆjdkrŽˆjjƒˆjƒˆjjƒˆjdƒdSrÏ) r¾r}rOrorr rÐr¿rÔrÑ©Zbarrier2rr€rÖrrrr|s      z,BarrierTests.test_abort_and_reset..frrEN)r¼rOrÀrMrrGrrØrÚtest_abort_and_resetts  z!BarrierTests.test_abort_and_resetcs‡fdd„}ˆj|ƒdS)z$ Test wait(timeout) cs:ˆjjƒ}|ˆjdkr"tjdƒˆjtjˆjjdƒdS)Nrhr±rZ)r¾r}rOrrrTr rÐrÑrrrršs   z$BarrierTests.test_timeout..fNrÆrGrrrr`–s zBarrierTests.test_timeoutcs,ˆjˆjdd‰‡‡fdd„}ˆj|ƒdS)z4 Test the barrier's default timeout g333333Ó?rXcs4ˆjƒ}|ˆjdkr tjdƒˆjtjˆjƒdS)Nrhr±)r}rOrrrTr rÐrÑ©r¾rrrrªs z,BarrierTests.test_default_timeout..fNrÍrGrrÚrÚtest_default_timeout¤sz!BarrierTests.test_default_timeoutcCs|jdƒ}|jƒ|jƒdSr·)r¼r})rrPrrrÚtest_single_thread²s zBarrierTests.test_single_threadN)rE)r#r$r%r&rOr½r)r*rÀrÃrÇrÈrÊrÎrÓr×rÙr`rÛrÜrrrrr»÷s"  "r»)r&r§rZ_threadrrr ZunittestraZtestrr Zobjectr ZTestCaser'r-rfrnrurŠr¥r¶rºr»rrrrZs* 11C^0~