grthtrhthjhtyjytjytkergtrhtrjytjerhrfh4:24 29/09/2026 ”qcƒ¿ã@sUdZddlZddlZddlmZddlmZ ddl m Z ddl m ZmZyddlmZWn"ek rœddlmZYnXdd d d d d dddddddddddgZejZejZejZejZejZy ejZ Wne!k r*dZ YnXej"Z"[da#da$dd„Z%dd„Z&eZ'dd„ZGdd„dƒZ(e(Z)Gdd „d ƒZ*Gdd„dƒZ+Gd d„de+ƒZ,Gd!d „d ƒZ-Gd"d„dƒZ.Gd#d$„d$e/ƒZ0eƒj1Z2e2ƒd%d&d'„Z3eƒa4iZ5iZ6e ƒZ7Gd(d„dƒZ8Gd)d„de8ƒZ9Gd*d+„d+e8ƒZ:Gd,d-„d-e8ƒZ;d.d „Z<e<Z=d/d„Z>e>Z?d0d1„Z@d2d „ZAdd3lmBZBe:ƒaCd4d5„ZDd6d7„ZEd8d9„ZFydd:lmGZHWn"ek rDdd;lImHZHYnXd<d=„ZJdS)>z;Thread module emulating a subset of Java's threading model.éN)Ú monotonic)Ú format_exc)ÚWeakSet)ÚisliceÚcount)ÚdequeÚ active_countÚ ConditionÚcurrent_threadÚ enumerateÚEventÚLockÚRLockÚ SemaphoreÚBoundedSemaphoreÚThreadÚBarrierÚTimerÚ ThreadErrorÚ setprofileÚsettraceÚlocalÚ stack_sizecCs |adS)z¸Set a profile function for all threads started from the threading module. The func will be passed to sys.setprofile() for each thread, before its run() method is called. N)Ú _profile_hook)Úfunc©rú./opt/alt/python35/lib64/python3.5/threading.pyr0scCs |adS)z´Set a trace function for all threads started from the threading module. The func will be passed to sys.settrace() for each thread, before its run() method is called. N)Ú _trace_hook)rrrrr:scOs&tdkrt||ŽSt||ŽS)a2Factory function that returns a new reentrant lock. A reentrant lock must be released by the thread that acquired it. Once a thread has acquired a reentrant lock, the same thread may acquire it again without blocking; the thread must release it once for each time it has acquired it. N)Ú_CRLockÚ_PyRLock)ÚargsÚkwargsrrrrHs  c@s‚eZdZdZdd„Zdd„Zdddd „ZeZd d „Zd d „Z dd„Z dd„Z dd„Z dS)Ú_RLocka,This class implements reentrant lock objects. A reentrant lock must be released by the thread that acquired it. Once a thread has acquired a reentrant lock, the same thread may acquire it again without blocking; the thread must release it once for each time it has acquired it. cCs"tƒ|_d|_d|_dS)Nr)Ú_allocate_lockÚ_blockÚ_ownerÚ_count)ÚselfrrrÚ__init___s  z_RLock.__init__cCsy|j}yt|j}Wntk r.YnXd|jjƒrGdnd|jj|jj||j t t |ƒƒfS)Nz)<%s %s.%s object owner=%r count=%d at %s>ÚlockedZunlocked) r%Ú_activeÚnameÚKeyErrorr$r)Ú __class__Ú __module__Ú __qualname__r&ÚhexÚid)r'ÚownerrrrÚ__repr__ds    z_RLock.__repr__TécCs\tƒ}|j|kr+|jd7_dS|jj||ƒ}|rX||_d|_|S)aAcquire a lock, blocking or non-blocking. When invoked without arguments: if this thread already owns the lock, increment the recursion level by one, and return immediately. Otherwise, if another thread owns the lock, block until the lock is unlocked. Once the lock is unlocked (not owned by any thread), then grab ownership, set the recursion level to one, and return. If more than one thread is blocked waiting until the lock is unlocked, only one at a time will be able to grab ownership of the lock. There is no return value in this case. When invoked with the blocking argument set to true, do the same thing as when called without arguments, and return true. When invoked with the blocking argument set to false, do not block. If a call without an argument would block, return false immediately; otherwise, do the same thing as when called without arguments, and return true. When invoked with the floating-point timeout argument set to a positive value, block for at most the number of seconds specified by timeout and as long as the lock cannot be acquired. Return true if the lock has been acquired, false if the timeout has elapsed. r4)Ú get_identr%r&r$Úacquire)r'ÚblockingÚtimeoutÚmeÚrcrrrr6ss   z_RLock.acquirecCsR|jtƒkrtdƒ‚|jd|_}|sNd|_|jjƒdS)amRelease a lock, decrementing the recursion level. If after the decrement it is zero, reset the lock to unlocked (not owned by any thread), and if any other threads are blocked waiting for the lock to become unlocked, allow exactly one of them to proceed. If after the decrement the recursion level is still nonzero, the lock remains locked and owned by the calling thread. Only call this method when the calling thread owns the lock. A RuntimeError is raised if this method is called when the lock is unlocked. There is no return value. zcannot release un-acquired lockr4N)r%r5Ú RuntimeErrorr&r$Úrelease)r'rrrrr<™s   z_RLock.releasecCs|jƒdS)N)r<)r'ÚtÚvÚtbrrrÚ__exit__°sz_RLock.__exit__cCs#|jjƒ|\|_|_dS)N)r$r6r&r%)r'ÚstaterrrÚ_acquire_restoreµs z_RLock._acquire_restorecCsV|jdkrtdƒ‚|j}d|_|j}d|_|jjƒ||fS)Nrzcannot release un-acquired lock)r&r;r%r$r<)r'rr2rrrÚ _release_save¹s      z_RLock._release_savecCs|jtƒkS)N)r%r5)r'rrrÚ _is_ownedÃsz_RLock._is_ownedNéÿÿÿÿ) Ú__name__r.r/Ú__doc__r(r3r6Ú __enter__r<r@rBrCrDrrrrr"Us   $    r"c@s¬eZdZdZddd„Zdd„Zdd„Zd d „Zd d „Zd d„Z dd„Z ddd„Z ddd„Z ddd„Z dd„ZeZdS)r ajClass that implements a condition variable. A condition variable allows one or more threads to wait until they are notified by another thread. If the lock argument is given and not None, it must be a Lock or RLock object, and it is used as the underlying lock. Otherwise, a new RLock object is created and used as the underlying lock. NcCsµ|dkrtƒ}||_|j|_|j|_y|j|_Wntk rZYnXy|j|_Wntk rYnXy|j|_Wntk r¤YnXtƒ|_ dS)N) rÚ_lockr6r<rCÚAttributeErrorrBrDÚ_dequeÚ_waiters)r'Úlockrrrr(Õs$        zCondition.__init__cCs |jjƒS)N)rIrH)r'rrrrHíszCondition.__enter__cGs|jj|ŒS)N)rIr@)r'r rrrr@ðszCondition.__exit__cCsd|jt|jƒfS)Nz)rIÚlenrL)r'rrrr3ószCondition.__repr__cCs|jjƒdS)N)rIr<)r'rrrrCöszCondition._release_savecCs|jjƒdS)N)rIr6)r'ÚxrrrrBùszCondition._acquire_restorecCs+|jjdƒr#|jjƒdSdSdS)NrFT)rIr6r<)r'rrrrDüs zCondition._is_ownedcCsè|jƒstdƒ‚tƒ}|jƒ|jj|ƒ|jƒ}d}zW|dkro|jƒd}n0|dkr�|jd|ƒ}n|jdƒ}|SWd|j|ƒ|sãy|jj|ƒWnt k râYnXXdS)akWait until notified or until a timeout occurs. If the calling thread has not acquired the lock when this method is called, a RuntimeError is raised. This method releases the underlying lock, and then blocks until it is awakened by a notify() or notify_all() call for the same condition variable in another thread, or until the optional timeout occurs. Once awakened or timed out, it re-acquires the lock and returns. When the timeout argument is present and not None, it should be a floating point number specifying a timeout for the operation in seconds (or fractions thereof). When the underlying lock is an RLock, it is not released using its release() method, since this may not actually unlock the lock when it was acquired multiple times recursively. Instead, an internal interface of the RLock class is used, which really unlocks it even when it has been recursively acquired several times. Another internal interface is then used to restore the recursion level when the lock is reacquired. zcannot wait on un-acquired lockFNTr) rDr;r#r6rLÚappendrCrBÚremoveÚ ValueError)r'r8ÚwaiterZ saved_stateZgotitrrrÚwaits*           zCondition.waitcCs~d}|}|ƒ}xb|sy|dk r`|dkrFtƒ|}n|tƒ}|dkr`P|j|ƒ|ƒ}qW|S)zÜWait until a condition evaluates to True. predicate should be a callable which result will be interpreted as a boolean value. A timeout may be provided giving the maximum time to wait. Nr)Ú_timerT)r'Z predicater8ÚendtimeZwaittimeÚresultrrrÚwait_for5s        zCondition.wait_forr4c Cs…|jƒstdƒ‚|j}tt||ƒƒ}|s@dSx>|D]6}|jƒy|j|ƒWqGtk r|YqGXqGWdS)aKWake up one or more threads waiting on this condition, if any. If the calling thread has not acquired the lock when this method is called, a RuntimeError is raised. This method wakes up at most n of the threads waiting for the condition variable; it is a no-op if no threads are waiting. z!cannot notify on un-acquired lockN)rDr;rLrKÚ_islicer<rQrR)r'ÚnZ all_waitersZwaiters_to_notifyrSrrrÚnotifyLs      zCondition.notifycCs|jt|jƒƒdS)z¯Wake up all threads waiting on this condition. If the calling thread has not acquired the lock when this method is called, a RuntimeError is raised. N)r[rNrL)r'rrrÚ notify_allcszCondition.notify_all)rFr.r/rGr(rHr@r3rCrBrDrTrXr[r\Z notifyAllrrrrr És       0 c@sUeZdZdZddd„Zdddd„ZeZd d „Zd d „ZdS) raGThis class implements semaphore objects. Semaphores manage a counter representing the number of release() calls minus the number of acquire() calls, plus an initial value. The acquire() method blocks if necessary until it can return without making the counter negative. If not given, value defaults to 1. r4cCs7|dkrtdƒ‚ttƒƒ|_||_dS)Nrz$semaphore initial value must be >= 0)rRr r Ú_condÚ_value)r'Úvaluerrrr({s  zSemaphore.__init__TNc CsÄ| r|dk rtdƒ‚d}d}|j�‰x�|jdkr£|sNP|dk r�|dkrvtƒ|}n|tƒ}|dkr�P|jj|ƒq8W|jd8_d}WdQRX|S)aÔAcquire a semaphore, decrementing the internal counter by one. When invoked without arguments: if the internal counter is larger than zero on entry, decrement it by one and return immediately. If it is zero on entry, block, waiting until some other thread has called release() to make it larger than zero. This is done with proper interlocking so that if multiple acquire() calls are blocked, release() will wake exactly one of them up. The implementation may pick one at random, so the order in which blocked threads are awakened should not be relied on. There is no return value in this case. When invoked with blocking set to true, do the same thing as when called without arguments, and return true. When invoked with blocking set to false, do not block. If a call without an argument would block, return false immediately; otherwise, do the same thing as when called without arguments, and return true. When invoked with a timeout other than None, it will block for at most timeout seconds. If acquire does not complete successfully in that interval, return false. Return true otherwise. Nz.can't specify timeout for non-blocking acquireFrr4T)rRr]r^rUrT)r'r7r8r:rVrrrr6�s$       zSemaphore.acquirec Cs1|j�!|jd7_|jjƒWdQRXdS)z×Release a semaphore, incrementing the internal counter by one. When the counter is zero on entry and another thread is waiting for it to become larger than zero again, wake up that thread. r4N)r]r^r[)r'rrrr<°s zSemaphore.releasecCs|jƒdS)N)r<)r'r=r>r?rrrr@»szSemaphore.__exit__) rFr.r/rGr(r6rHr<r@rrrrros - c@s1eZdZdZddd„Zdd„ZdS)ra©Implements a bounded semaphore. A bounded semaphore checks to make sure its current value doesn't exceed its initial value. If it does, ValueError is raised. In most situations semaphores are used to guard resources with limited capacity. If the semaphore is released too many times it's a sign of a bug. If not given, value defaults to 1. Like regular semaphores, bounded semaphores manage a counter representing the number of release() calls minus the number of acquire() calls, plus an initial value. The acquire() method blocks if necessary until it can return without making the counter negative. If not given, value defaults to 1. r4cCstj||ƒ||_dS)N)rr(Ú_initial_value)r'r_rrrr(ÐszBoundedSemaphore.__init__c CsO|j�?|j|jkr(tdƒ‚|jd7_|jjƒWdQRXdS)a6Release a semaphore, incrementing the internal counter by one. When the counter is zero on entry and another thread is waiting for it to become larger than zero again, wake up that thread. If the number of releases exceeds the number of acquires, raise a ValueError. z!Semaphore released too many timesr4N)r]r^r`rRr[)r'rrrr<Ôs  zBoundedSemaphore.releaseN)rFr.r/rGr(r<rrrrr¿s c@sgeZdZdZdd„Zdd„Zdd„ZeZdd „Zd d „Z d d d„Z d S)r zòClass implementing event objects. Events manage a flag that can be set to true with the set() method and reset to false with the clear() method. The wait() method blocks until the flag is true. The flag is initially false. cCsttƒƒ|_d|_dS)NF)r r r]Ú_flag)r'rrrr(ðszEvent.__init__cCs|jjtƒƒdS)N)r]r(r )r'rrrÚ_reset_internal_locksôszEvent._reset_internal_lockscCs|jS)z5Return true if and only if the internal flag is true.)ra)r'rrrÚis_setøsz Event.is_setc Cs+|j�d|_|jjƒWdQRXdS)z·Set the internal flag to true. All threads waiting for it to become true are awakened. Threads that call wait() once the flag is true will not block at all. TN)r]rar\)r'rrrÚsetþs  z Event.setc Cs|j�d|_WdQRXdS)zªReset the internal flag to false. Subsequently, threads calling wait() will block until set() is called to set the internal flag to true again. FN)r]ra)r'rrrÚclear s z Event.clearNc Cs:|j�*|j}|s+|jj|ƒ}|SWdQRXdS)aHBlock until the internal flag is true. If the internal flag is true on entry, return immediately. Otherwise, block until another thread calls set() to set the flag to true, or until the optional timeout occurs. When the timeout argument is present and not None, it should be a floating point number specifying a timeout for the operation in seconds (or fractions thereof). This method returns the internal flag on exit, so it will always return True except if a timeout is given and the operation times out. N)r]rarT)r'r8ZsignaledrrrrTs   z Event.wait) rFr.r/rGr(rbrcZisSetrdrerTrrrrr ås     c@sÁeZdZdZdddd„Zddd„Zdd„Zd d „Zd d „Zd d„Z dd„Z dd„Z dd„Z e dd„ƒZe dd„ƒZe dd„ƒZdS)rzÑImplements a Barrier. Useful for synchronizing a fixed number of threads at known synchronization points. Threads block on 'wait()' and are simultaneously once they have all made that call. NcCsCttƒƒ|_||_||_||_d|_d|_dS)aWCreate a barrier, initialised to 'parties' threads. 'action' is a callable which, when supplied, will be called by one of the threads after they have all entered the barrier and just prior to releasing them all. If a 'timeout' is provided, it is uses as the default for all subsequent 'wait()' calls. rN)r r r]Ú_actionÚ_timeoutÚ_partiesÚ_stater&)r'ÚpartiesÚactionr8rrrr(=s     zBarrier.__init__cCsž|dkr|j}|j�y|jƒ|j}|jd7_z5|d|jkrd|jƒn |j|ƒ|SWd|jd8_|jƒXWdQRXdS)aNWait for the barrier. When the specified number of threads have started waiting, they are all simultaneously awoken. If an 'action' was provided for the barrier, one of the threads will have executed that callback prior to returning. Returns an individual index number from 0 to 'parties-1'. Nr4)rgr]Ú_enterr&rhÚ_releaseÚ_waitÚ_exit)r'r8ÚindexrrrrTMs       z Barrier.waitcCsQx |jdkr"|jjƒqW|jdkr8t‚|jdksMt‚dS)Nr4rrE)rEr4)rir]rTÚBrokenBarrierErrorÚAssertionError)r'rrrrlks zBarrier._enterc CsIy-|jr|jƒd|_|jjƒWn|jƒ‚YnXdS)Nr4)rfrir]r\Ú_break)r'rrrrmvs    zBarrier._releasecs_ˆjj‡fdd†|ƒs1ˆjƒt‚ˆjdkrFt‚ˆjdks[t‚dS)Ncs ˆjdkS)Nr)rir)r'rrÚ…szBarrier._wait..rr4)r]rXrsrqrirr)r'r8r)r'rrn„s ! z Barrier._waitcCs8|jdkr4|jdkr4d|_|jjƒdS)Nrr4rE)rEr4)r&rir]r\)r'rrrro�s z Barrier._exitc Csp|j�`|jdkrO|jdkr4d|_qX|jdkrXd|_n d|_|jjƒWdQRXdS)z�Reset the barrier to the initial state. Any threads currently waiting will get the BrokenBarrier exception raised. rr4éNrEéþÿÿÿrE)r]r&rir\)r'rrrÚreset–s    z Barrier.resetc Cs|j�|jƒWdQRXdS)zÃPlace the barrier into a 'broken' state. Useful in case of error. Any currently waiting threads and threads attempting to 'wait()' will have BrokenBarrierError raised. N)r]rs)r'rrrÚabortªs z Barrier.abortcCsd|_|jjƒdS)Nrurv)rir]r\)r'rrrrs´s zBarrier._breakcCs|jS)z:Return the number of threads required to trip the barrier.)rh)r'rrrrjºszBarrier.partiescCs|jdkr|jSdS)z>Return the number of threads currently waiting at the barrier.r)rir&)r'rrrÚ n_waiting¿szBarrier.n_waitingcCs |jdkS)z0Return True if the barrier is in a broken state.rurv)ri)r'rrrÚbrokenÈszBarrier.broken)rFr.r/rGr(rTrlrmrnrorwrxrsÚpropertyrjryrzrrrrr4s      c@seZdZdS)rqN)rFr.r/rrrrrqÎs rqz Thread-%dcCs |tƒS)N)Ú_counter)ÚtemplaterrrÚ_newnameÕsr~c @s�eZdZdZdZejZdddfddddd„Zdd„Z d d „Z d d „Z d d„Z dd„Z dd„Zdd„Zdd„Zdd„Zdd„Zddd„Zdd3dd „Zed!d"„ƒZejd#d"„ƒZed$d%„ƒZd&d'„ZeZed(d)„ƒZejd*d)„ƒZd+d,„Zd-d.„Zd/d0„Zd1d2„ZdS)4raA class that represents a thread of control. This class can be safely subclassed in a limited fashion. There are two ways to specify the activity: by passing a callable object to the constructor, or by overriding the run() method in a subclass. FNÚdaemoncCsÑ|dkstdƒ‚|dkr*i}||_t|pBtƒƒ|_||_||_|dk ru||_ntƒj |_d|_ d|_ t ƒ|_ d|_d|_tj|_tj|ƒdS)aKThis constructor should always be called with keyword arguments. Arguments are: *group* should be None; reserved for future extension when a ThreadGroup class is implemented. *target* is the callable object to be invoked by the run() method. Defaults to None, meaning nothing is called. *name* is the thread name. By default, a unique name is constructed of the form "Thread-N" where N is a small decimal number. *args* is the argument tuple for the target invocation. Defaults to (). *kwargs* is a dictionary of keyword arguments for the target invocation. Defaults to {}. If a subclass overrides the constructor, it must make sure to invoke the base class constructor (Thread.__init__()) before doing anything else to the thread. Nz#group argument must be None for nowFT)rrÚ_targetÚstrr~Ú_nameÚ_argsÚ_kwargsÚ _daemonicr rÚ_identÚ _tstate_lockr Ú_startedÚ _is_stoppedÚ _initializedÚ_sysÚstderrÚ_stderrÚ _danglingÚadd)r'ÚgroupÚtargetr+r r!rrrrr(ós"            zThread.__init__cCs6|jjƒ|r |jƒnd|_d|_dS)NT)rˆrbÚ_set_tstate_lockr‰r‡)r'Úis_aliverrrrb s    zThread._reset_internal_lockscCs–|jstdƒ‚d}|jjƒr0d}|jƒ|jrId}|jr\|d7}|jdk r||d|j7}d|jj |j |fS)Nz Thread.__init__() was not calledÚinitialZstartedZstoppedz daemonz %sz <%s(%s, %s)>) rŠrrrˆrcr“r‰r…r†r-rFr‚)r'Zstatusrrrr3,s    zThread.__repr__cCsš|jstdƒ‚|jjƒr0tdƒ‚t�|t||j}|dk r(|jƒ s(t‚d|_d|_dS)NT)r‡r)rrr‰)r'rMrrrÚ_stopÄs    z Thread._stopcCsGyt�ttƒ=WdQRXWn$tk rBdtjkr>‚YnXdS)zARemove current thread from the dict of currently running threads.NZdummy_threading)r•r*r5r,r‹Úmodules)r'rrrÚ_deleteÛs  zThread._deletecCs�|jstdƒ‚|jjƒs0tdƒ‚|tƒkrKtdƒ‚|dkrd|jƒn|jdt|dƒƒdS)aWait until the thread terminates. This blocks the calling thread until the thread whose join() method is called terminates -- either normally or through an unhandled exception or until the optional timeout occurs. When the timeout argument is present and not None, it should be a floating point number specifying a timeout for the operation in seconds (or fractions thereof). As join() always returns None, you must call isAlive() after join() to decide whether a timeout happened -- if the thread is still alive, the join() call timed out. When the timeout argument is not present or None, the operation will block until the thread terminates. A thread can be join()ed many times. join() raises a RuntimeError if an attempt is made to join the current thread as that would cause a deadlock. It is also an error to join() a thread before it has been started and attempts to do so raises the same exception. zThread.__init__() not calledz'cannot join thread before it is startedzcannot join current threadNr8r)rŠr;rˆrcr Ú_wait_for_tstate_lockÚmax)r'r8rrrÚjoinþs      z Thread.joinTr4cCsQ|j}|dkr'|jsMt‚n&|j||ƒrM|jƒ|jƒdS)N)r‡r‰rrr6r<r¬)r'Úblockr8rMrrrr¯$s    zThread._wait_for_tstate_lockcCs|jstdƒ‚|jS)z¸A string used for identification purposes only. It has no semantics. Multiple threads may be given the same name. The initial name is set by the constructor. zThread.__init__() not called)rŠrrr‚)r'rrrr+2sz Thread.namecCs(|jstdƒ‚t|ƒ|_dS)NzThread.__init__() not called)rŠrrr�r‚)r'r+rrrr+=scCs|jstdƒ‚|jS)a;Thread identifier of this thread or None if it has not been started. This is a nonzero integer. See the thread.get_ident() function. Thread identifiers may be recycled when a thread exits and another thread is created. The identifier is available even after the thread has exited. zThread.__init__() not called)rŠrrr†)r'rrrÚidentBs z Thread.identcCsG|jstdƒ‚|js.|jjƒ r2dS|jdƒ|j S)zöReturn whether the thread is alive. This method returns True just before the run() method starts until just after the run() method terminates. The module function enumerate() returns a list of all alive threads. zThread.__init__() not calledF)rŠrrr‰rˆrcr¯)r'rrrr“Ns  zThread.is_alivecCs|jstdƒ‚|jS)aÆA boolean value indicating whether this thread is a daemon thread. This must be set before start() is called, otherwise RuntimeError is raised. Its initial value is inherited from the creating thread; the main thread is not a daemon thread and therefore all threads created in the main thread default to daemon = False. The entire Python program exits when no alive non-daemon threads are left. zThread.__init__() not called)rŠrrr…)r'rrrr^s z Thread.daemoncCs=|jstdƒ‚|jjƒr0tdƒ‚||_dS)NzThread.__init__() not calledz)cannot set daemon status of active thread)rŠr;rˆrcr…)r'Údaemonicrrrrns    cCs|jS)N)r)r'rrrÚisDaemonvszThread.isDaemoncCs ||_dS)N)r)r'r´rrrÚ setDaemonyszThread.setDaemoncCs|jS)N)r+)r'rrrÚgetName|szThread.getNamecCs ||_dS)N)r+)r'r+rrrÚsetNameszThread.setNamerE) rFr.r/rGrŠr‹Úexc_infor£r(rbr3ršr›r˜r�r’rœr¬r®r±r¯r{r+Úsetterr³r“ZisAliverrµr¶r·r¸rrrrràs8   ,       A  #&     c@s@eZdZdZdddd„Zdd„Zdd„ZdS) rzÓCall a function after a specified number of seconds: t = Timer(30.0, f, args=None, kwargs=None) t.start() t.cancel() # stop the timer's action if it's still waiting NcCsetj|ƒ||_||_|dk r1|ng|_|dk rL|ni|_tƒ|_dS)N)rr(ÚintervalÚfunctionr r!r Úfinished)r'r»r¼r r!rrrr(�s    zTimer.__init__cCs|jjƒdS)z)Stop the timer if it hasn't finished yet.N)r½rd)r'rrrÚcancel•sz Timer.cancelcCsI|jj|jƒ|jjƒs8|j|j|jŽ|jjƒdS)N)r½rTr»rcr¼r r!rd)r'rrrr›™sz Timer.run)rFr.r/rGr(r¾r›rrrrr„s  c@seZdZdd„ZdS)Ú _MainThreadc CsYtj|ddddƒ|jƒ|jjƒ|jƒt�|t|js„               q¦P&Oš   ÿ¥