3 Ø ÷^Îpã@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)Ng{®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_threadÚ __enter__Úranger)rrrZwait_before_exitrÚir)rrrÚ__init__s   zBunch.__init__cCs xt|jƒ|jkrtƒqWdS)N)Úlenr rr )rrrrÚwait_for_started6szBunch.wait_for_startedcCs0xt|jƒ|jkrtƒqW|jjdddƒdS)N)rrrr rÚ__exit__)rrrrÚwait_for_finished:s zBunch.wait_for_finishedcCs d|_dS)NT)r)rrrrÚ do_finish@szBunch.do_finishN)F)Ú__name__Ú __module__Ú __qualname__Ú__doc__rrrr rrrrr s  r c@s$eZdZdd„Zdd„Zdd„ZdS)Ú BaseTestCasecCstjƒ|_dS)N)rZthreading_setupÚ_threads)rrrrÚsetUpEszBaseTestCase.setUpcCstj|jŽtjƒdS)N)rZthreading_cleanupr&Z reap_children)rrrrÚ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ƒ}~dS)N)Úlocktype)rÚlockrrrÚtest_constructorZszBaseLockTests.test_constructorcCs|jƒ}|jt|ƒdƒ~dS)Nz)r,Ú assertRegexÚrepr)rr-rrrÚ test_repr^szBaseLockTests.test_reprcCs&|jƒ}|jƒ|jt|ƒdƒ~dS)Nz)r,Úacquirer/r0)rr-rrrÚtest_locked_reprcszBaseLockTests.test_locked_reprcCs|jƒ}|jƒ~dS)N)r,r2)rr-rrrÚtest_acquire_destroyisz"BaseLockTests.test_acquire_destroycCs|jƒ}|jƒ|jƒ~dS)N)r,r2Úrelease)rr-rrrÚtest_acquire_releasensz"BaseLockTests.test_acquire_releasecCs$|jƒ}|j|jdƒƒ|jƒdS)NF)r,Ú assertTruer2r5)rr-rrrÚtest_try_acquiretszBaseLockTests.test_try_acquirecsJ|jƒ‰ˆjƒg‰‡‡fdd„}t|dƒjƒ|jˆdƒˆjƒdS)NcsˆjˆjdƒƒdS)NF)rr2r)r-Úresultrrr}sz3BaseLockTests.test_try_acquire_contended..fér)r,r2r rÚ assertFalser5)rrr)r-r9rÚ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écsˆjƒˆjƒdS)N)r2r5r)r-rrr‡sz/BaseLockTests.test_acquire_contended..fr) r,r2r rr Ú assertEqualrrr5r)rÚNrÚbr)r-rÚtest_acquire_contendedƒs  z$BaseLockTests.test_acquire_contendedcsV|jƒ‰‡fdd„}d‡fdd„ }|ƒt|dƒjƒ|jt|tƒt|dƒjƒdS)NcsˆjƒˆjƒdS)N)r2r5r)r-rrr•sz"BaseLockTests.test_with..fc s ˆ|dk r|‚WdQRXdS)Nr)Úerr)r-rrÚ_with˜sz&BaseLockTests.test_with.._withr:)N)r,r rÚ assertRaisesÚ TypeError)rrrCr)r-rÚ test_with“s zBaseLockTests.test_withcs`|jƒ‰‡fdd„}ttjƒƒ}t|dƒjƒttjƒƒ|kr\tjdƒ|j|ttjƒƒƒdS)NcsˆjƒˆjƒdS)N)r2r5r)r-rrr§sz)BaseLockTests.test_thread_leak..fégš™™™™™Ù?) r,rr Ú enumerater rrrr>)rrrr)r-rÚ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) Nrr:éd)Útimeoutg}Ô%­I²Tr=cs4tjƒ}ˆjˆjddƒtjƒ}ˆj||ƒdS)Ngà?)rK)rrr2)Út1Út2)r-ÚresultsrrrÇsz%BaseLockTests.test_timeout..fgà?iœÿÿÿ)r,rDÚ ValueErrorr2Ú OverflowErrorrr5rr7r)r rr;r*)rrLrMrr)r-rNrÚ test_timeout¶s  zBaseLockTests.test_timeoutcCs"|jƒ}tj|ƒ}|j|ƒƒdS)N)r,ÚweakrefÚrefZassertIsNotNone)rr-rSrrrÚtest_weakref_existsÐs z!BaseLockTests.test_weakref_existscCs$|jƒ}tj|ƒ}~|j|ƒƒdS)N)r,rRrSZ assertIsNone)rr-rSrrrÚtest_weakref_deletedÕs z"BaseLockTests.test_weakref_deletedN)r!r"r#r$r.r1r3r4r6r8r<rArFrIrQrTrUrrrrr+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ƒdS)N)r2rr)r-Úphaserrræs z#LockTests.test_reacquire..frr:é)r,rrrrr r>r5)rrr)r-rWrÚtest_reacquireás    zLockTests.test_reacquirecsB|jƒ‰ˆjƒ‡fdd„}t|dƒ}|jƒˆjƒˆjƒdS)Ncs ˆjƒdS)N)r5r)r-rrrûsz*LockTests.test_different_thread..fr:)r,r2r rr5)rrr@r)r-rÚtest_different_thread÷s  zLockTests.test_different_threadcCsN|jƒ}|jƒ|j|jddƒ|jƒ|j|jƒƒ|j|jddƒdS)Ng{®Gáz„?)rKF)Zblocking)r,r2r;r5Úlockedr7)rr-rrrÚtest_state_after_timeouts z"LockTests.test_state_after_timeoutN)r!r"r#r$rYrZr\rrrrrVÜs rVc@s8eZdZdZdd„Zdd„Zdd„Zdd „Zd d „Zd S) Ú RLockTestsz$ Tests for recursive locks. cCs<|jƒ}|jƒ|jƒ|jƒ|jƒ|jƒ|jƒdS)N)r,r2r5)rr-rrrrYszRLockTests.test_reacquirecCsX|jƒ}|jt|jƒ|jƒ|jƒ|jƒ|jƒ|jƒ|jƒ|jt|jƒdS)N)r,rDÚ RuntimeErrorr5r2)rr-rrrÚtest_release_unacquiredsz"RLockTests.test_release_unacquiredcCsX|jƒ}|jt|jƒ|jƒ|jƒ|jƒ|jƒ|jƒ|jƒ|jt|jƒdS)N)r,rDr^Ú _release_saver2r5)rr-rrrÚtest_release_save_unacquired&sz'RLockTests.test_release_save_unacquiredc sJ|jƒ‰‡fdd„}t|ddƒ}z|jtˆjƒWd|jƒX|jƒdS)Ncs ˆjƒdS)N)r2r)r-rrr5sz+RLockTests.test_different_thread..fr:T)r,r rDr^r5r r)rrr@r)r-rrZ2s   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ƒƒdS)N)rÚ _is_ownedr)r-r9rrrFsz$RLockTests.test__is_owned..fr:r)r,r;rbr2r7r rr5)rrr)r-r9rÚtest__is_owned>szRLockTests.test__is_ownedN) r!r"r#r$rYr_rarZrcrrrrr] s     r]c@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ƒƒdS)N)Ú eventtyper;Zis_setÚsetr7Ú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)Nr=cs ˆjˆjƒƒˆjˆjƒƒdS)N)rÚwaitr)rhÚresults1Úresults2rrrfsz#EventTests._check_notify..frT)r rr r>rrfr)rrhr?rr@r)rhrkrlrÚ _check_notifyas zEventTests._check_notifycCs0|jƒ}|j|ƒ|jƒ|jƒ|j|ƒdS)N)rermrfrg)rrhrrrÚ 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)Nr=cs@ˆjˆjdƒƒtjƒ}ˆjdƒ}tjƒ}ˆj|||fƒdS)Nggà?)rrjr)rLÚrrM)rhrkrlrrrs  z"EventTests.test_timeout..fFgà?T)rer rr>r;r*rfr7)rr?rroÚdtr)rhrkrlrrQzs" zEventTests.test_timeoutcsn|jƒ‰g‰d‰d}‡‡‡fdd„}t||ƒ}|jƒtjˆƒˆjƒˆjƒ|jƒ|jˆdg|ƒdS)NgÐ?r=csˆjˆjˆdƒƒdS)Né)rrjr)rhrNrKrrršsz(EventTests.test_set_and_clear..fT) rer rrrrfrgrr>)rr?rr@r)rhrNrKrÚtest_set_and_clear“s  zEventTests.test_set_and_clearcCs\|jƒ}|j|j|jjdƒƒWdQRX|jƒ|j|j|jjdƒƒWdQRXdS)NF)reZ_condr;r2Z_reset_internal_locks)rrhrrrÚtest_reset_internal_locks¤s z$EventTests.test_reset_internal_locksN) r!r"r#r$rirmrnrQrrrsrrrrrdPs rdc@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ƒƒWdQRXdS)NF)Úcondtyper2r5r ZLockr;r7)rÚcondr-rrrÚ test_acquire³s zConditionTests.test_acquirecCs|jƒ}|jt|jƒdS)N)rurDr^rj)rrvrrrÚtest_unacquired_waitÆsz#ConditionTests.test_unacquired_waitcCs|jƒ}|jt|jƒdS)N)rurDr^Únotify)rrvrrrÚtest_unacquired_notifyÊsz%ConditionTests.test_unacquired_notifycsìd}g‰g‰g‰d‰‡‡‡‡‡fdd„}t||ƒ}|jƒxtˆƒdkrPtƒq.fér:TrXé)Tr:)Tr:)TrX)TrX)Tr:)TrX)TrX)Tr}) r rrr rgr>r2ryr5Z notify_allr)rrvr?rr@r)rvr{r|rkrlrrmÎsX            zConditionTests._check_notifycCs |jƒ}|j|ƒ|j|ƒdS)N)rurm)rrvrrrrns zConditionTests.test_notifycsh|jƒ‰g‰d}‡‡fdd„}t||ƒjƒ|jtˆƒ|ƒx&ˆD]\}}|j|dƒ|j|ƒqBWdS)Nr=cs@ˆjƒtjƒ}ˆjdƒ}tjƒ}ˆjƒˆj|||fƒdS)Ngà?)r2rrjr5r)rLr9rM)rvrNrrr"s  z&ConditionTests.test_timeout..fgà?)rur rr>rr*r;)rr?rrpr9r)rvrNrrQs 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)NcsˆdkS)Nrqrr)ÚstaterrÚ9sz8ConditionTests.test_waitfor..f..rq)Úwait_forr7r>)r9)rvrrrrr7s z&ConditionTests.test_waitfor..fr:rqg{®Gáz„?)rur rrrrryr)rrr@rr)rvrrrÚ 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)NcsˆdkS)Nrqrr)rrrr€Lsz@ConditionTests.test_waitfor_timeout..f..gš™™™™™¹?)rK)rrr;r*r)rpr9)rvrrÚsuccessrrrIs   z.ConditionTests.test_waitfor_timeout..fr:r}g{®Gáz„?) rur rrrrryrr>r)rrr@rr)rvrrrƒrÚtest_waitfor_timeoutEs  z#ConditionTests.test_waitfor_timeoutN) r!r"r#r$rwrxrzrmrnrQr‚r„rrrrrt®sJrtc@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)Nr:)Úvalueéÿÿÿÿ)rDrOÚsemtypeÚsysÚmaxsize)rrrrr.bsz#BaseSemaphoreTests.test_constructorcCsH|jdƒ}|jƒ|jƒ|jdƒ}|jƒ|jƒ|jƒ|jƒdS)Nr:rX)rˆr2r5)rÚsemrrrrwfs  zBaseSemaphoreTests.test_acquirecCs|jƒ}|jƒ~dS)N)rˆr2)rr‹rrrr4psz'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ˆƒdS)N)rr2r)r{rkrlr‹Ú sem_resultsrrr}s z4BaseSemaphoreTests.test_acquire_contended..fér:é rXéFTrr‘é) rˆr2r rrr r>rr5Úsortedr;r)rr?rr@rr)r{rkrlr‹rŽrrAus:     $  .z)BaseSemaphoreTests.test_acquire_contendedcCsV|jdƒ}|j|jdƒƒ|j|jdƒƒ|j|jdƒƒ|jƒ|j|jdƒƒdS)NrXF)rˆr7r2r;r5)rr‹rrrr8šs  z#BaseSemaphoreTests.test_try_acquirecsV|jdƒ‰ˆjƒg‰‡‡fdd„}t|dƒjƒ|jtˆƒdgddgdƒdS) Nrqcs$ˆjˆjdƒƒˆjˆjdƒƒdS)NF)rr2r)rNr‹rrr¦sz8BaseSemaphoreTests.test_try_acquire_contended..fr=FrŒTr})rˆr2r rr>r“)rrr)rNr‹rr<¢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)NrXFgð?)rKg{®Gázt?gà?) rˆrDrOr2r7r;r5rr*)rr‹ÚtrprrrÚtest_acquire_timeout¯s  z'BaseSemaphoreTests.test_acquire_timeoutcsT|jƒ‰ˆjƒ‡fdd„}t|dƒ}|jƒtƒ|j|jƒˆjƒ|jƒdS)NcsˆjƒˆjƒdS)N)r2r5r)r‹rrrÀsz0BaseSemaphoreTests.test_default_value..fr:) rˆr2r rr r;rr5r)rrr@r)r‹rÚtest_default_value¼s   z%BaseSemaphoreTests.test_default_valuecsbˆjdƒ‰d‡‡fdd„ }|ƒˆjˆjdƒƒˆjƒˆjt|tƒˆjˆjdƒƒˆjƒdS)NrXcsTˆFˆjˆjdƒƒˆjƒˆˆjˆjdƒƒ|r<|‚WdQRXWdQRXdS)NF)r7r2r5r;)rB)rr‹rrrCÌsz+BaseSemaphoreTests.test_with.._withF)N)rˆr7r2r5rDrE)rrCr)rr‹rrFÊs zBaseSemaphoreTests.test_withN) r!r"r#r$r.rwr4rAr8r<r•r–rFrrrrr…]s %  r…c@seZdZdZdd„ZdS)ÚSemaphoreTestsz) Tests for unbounded semaphores. cCs.|jdƒ}|jƒ|jƒ|jƒ|jƒdS)Nr:)rˆr5r2)rr‹rrrr_às  z&SemaphoreTests.test_release_unacquiredN)r!r"r#r$r_rrrrr—Ûsr—c@seZdZdZdd„ZdS)ÚBoundedSemaphoreTestsz' Tests for bounded semaphores. cCs8|jƒ}|jt|jƒ|jƒ|jƒ|jt|jƒdS)N)rˆrDrOr5r2)rr‹rrrr_îs z-BoundedSemaphoreTests.test_release_unacquiredN)r!r"r#r$r_rrrrr˜ésr˜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. r=g@cCs|j|j|jd|_dS)N)rK)Ú barriertyper?ÚdefaultTimeoutÚbarrier)rrrrr'þszBarrierTests.setUpcCs|jjƒdS)N)rœÚabort)rrrrr(szBarrierTests.tearDowncCs"t||jdƒ}|ƒ|jƒdS)Nr:)r r?r)rrr@rrrÚ 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)NrTr:) rœZpartiesr>r?rrrrjÚ n_waitingr;Úbroken)rrNrÚmrrrrÚ multipasss zBarrierTests.multipassr:cs&ggg‰‡‡‡fdd„}ˆj|ƒdS)z; Test that a barrier is passed in lockstep csˆjˆˆƒdS)N)r¢r)ÚpassesrNrrrrsz$BarrierTests.test_barrier..fN)rž)rr£rr)r£rNrrÚ 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|ƒdS)N)rœrjr)ro)rNrrrr)s z(BarrierTests.test_wait_return..fN)ržr>Úsumrr?)rrr)rNrrÚtest_wait_return$s zBarrierTests.test_wait_returncs<g‰‡fdd„}ˆjˆj|ƒ‰‡‡‡fdd„}ˆj|ƒdS)z, Test the 'action' callback csˆjdƒdS)NT)rr)rNrrÚaction5sz(BarrierTests.test_action..actioncsˆjƒˆjtˆƒdƒdS)Nr:)rjr>rr)rœrNrrrr8sz#BarrierTests.test_action..fN)ršr?rž)rr¨rr)rœrNrrÚ 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)NrXT)rœrjr?r^rr ÚBrokenBarrierErrorr)r)rkrlrrrrDs   z"BarrierTests.test_abort..frr:N)ržr>rr?r7rœr )rrr)rkrlrrÚ 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)NrXr:gü©ñÒMbP?T) rœrjr?rŸrrÚresetrr rª)r)rkrlÚresults3rrrr]s    z"BarrierTests.test_reset..frr:N)ržr>rr?)rrr)rkrlr­rrÚ 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ƒdS)NrXT) rœrjr?r^rr rªrr¬)r)Úbarrier2rkrlr­rrrr|s      z,BarrierTests.test_abort_and_reset..frr:N)ršr?ržr>r)rrr)r¯rkrlr­rrÚtest_abort_and_resetts  z!BarrierTests.test_abort_and_resetcs‡fdd„}ˆj|ƒdS)z$ Test wait(timeout) cs:ˆjjƒ}|ˆjdkr"tjdƒˆjtjˆjjdƒdS)NrXgð?gà?)rœrjr?rrrDr rª)r)rrrršs   z$BarrierTests.test_timeout..fN)rž)rrr)rrrQ–s zBarrierTests.test_timeoutcs,ˆjˆjdd‰‡‡fdd„}ˆj|ƒdS)z4 Test the barrier's default timeout g333333Ó?)rKcs4ˆjƒ}|ˆjdkr tjdƒˆjtjˆjƒdS)NrXgð?)rjr?rrrDr rª)r)rœrrrrªs z,BarrierTests.test_default_timeout..fN)ršr?rž)rrr)rœrrÚtest_default_timeout¤sz!BarrierTests.test_default_timeoutcCs|jdƒ}|jƒ|jƒdS)Nr:)ršrj)rr@rrrÚtest_single_thread²s zBarrierTests.test_single_threadN)r:)r!r"r#r$r?r›r'r(ržr¢r¤r¥r§r©r«r®r°rQr±r²rrrrr™÷s"  "r™)r$r‰rÚ_threadrrr ZunittestrRZtestrr Úobjectr ZTestCaser%r+rVr]rdrtr…r—r˜r™rrrrÚs* 11C^0~