Your IP : 3.147.28.243


Current Path : /opt/alt/python313/lib64/python3.13/__pycache__/
Upload File :
Current File : //opt/alt/python313/lib64/python3.13/__pycache__/threading.cpython-313.pyc

�

1}g~����SrSSKrSSKrSSKrSSKrSSKJr	 SSK
Jr SSKJ
r SSKJr /SQr\R*r\R.r\R2r\R6r\R:r\R>r\R@r \RBr!\RDr"\RFr#\RHr$Sr%\RMS	5 \RPr)\RTr+\RXr,CSSKJ-r. Sq0Sq1S
r2Sr3Sr4Sr5Sr6Sr7\r8Sr*"SS5r9\9r:"SS5r;"SS5r<"SS\<5r="SS5r>"SS5r?"S S!\@5rA\"S"5R�rCS#rD\*"5qE0rF0rG\"5rH"S$S%5rISS&KJJqKJLrM [�rRS-rS"S.S/\I5rT"S0S1\I5rU\."5rV"S2S35rW"S4S5\I5rXS6rYS7rZS8r[S9r\S:r]S;r^/r_S
q`S<raSS=KJbrb \U"5qcS>rS?rdS@re\f"\SA5(a\R�"\eSB9 gg!\a
 SSKJr GNf=f!\'a S
r%GNtf=f!\'a Sr+GNjf=f!\a
 SSK/J.r. GNif=f!\a SS'KNJOrP SS(KJQrQ \Q"S)S*5rLS+rMS,qKN�f=f)Cz;Thread module emulating a subset of Java's threading model.�N)�	monotonic)�WeakSet)�count)�deque)�	get_ident�active_count�	Condition�current_thread�	enumerate�main_thread�TIMEOUT_MAX�Event�Lock�RLock�	Semaphore�BoundedSemaphore�Thread�Barrier�BrokenBarrierError�Timer�ThreadError�
setprofile�settrace�local�
stack_size�
excepthook�ExceptHookArgs�gettrace�
getprofile�setprofile_all_threads�settrace_all_threadsT�
get_native_idF)�_local)rc��Uqg)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��funcs �0/opt/alt/python313/lib64/python3.13/threading.pyrrHs	���M�c�F�[U5 [R"U5 g)z�Set a profile function for all threads started from the threading module
and all Python threads that are currently executing.

The func will be passed to sys.setprofile() for each thread, before its
run() method is called.
N)r�_sys�_setprofileallthreadsr's r)r r Qs���t�����t�$r*c��[$)z;Get the profiler function as set by threading.setprofile().r%�r*r)rr[s���r*c��Uqg)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_hookr's r)rr_s	���Kr*c�F�[U5 [R"U5 g)z�Set a trace function for all threads started from the threading module
and all Python threads that are currently executing.

The func will be passed to sys.settrace() for each thread, before its run()
method is called.
N)rr,�_settraceallthreadsr's r)r!r!hs��
�T�N����T�"r*c��[$)z6Get the trace function as set by threading.settrace().r1r/r*r)rrrs���r*c��U(dU(a[R"S[SS9 [c[	U0UD6$[U0UD6$)aFactory 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.

zDPassing arguments to RLock is deprecated and will be removed in 3.15���
stacklevel)�warnings�warn�DeprecationWarning�_CRLock�_PyRLock)�args�kwargss  r)rrzsE���v��
�
�R���	
�
����(��(�(��D�#�F�#�#r*c�\�\rSrSrSrSrSrSrSSjr\r	Sr
SrS	rS
r
SrSrS
rg)�_RLock�aThis 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.

c�>�[5UlSUlSUlg�Nr)�_allocate_lock�_block�_owner�_count��selfs r)�__init__�_RLock.__init__�s��$�&��������r*c�B�URn[URnSURR5(aSOSURRURRUUR[[U554-$![a N|f=f)Nz)<%s %s.%s object owner=%r count=%d at %s>�locked�unlocked)rH�_active�name�KeyErrorrGrO�	__class__�
__module__�__qualname__rI�hex�id)rK�owners  r)�__repr__�_RLock.__repr__�s�������	��E�N�'�'�E�;����*�*�,�,�H�*��N�N�%�%��N�N�'�'���K�K���4��M�
>
�
�	
���	��	�s�B�
B�Bc�T�URR5 SUlSUlgrE)rG�_at_fork_reinitrHrIrJs r)r]�_RLock._at_fork_reinit�s �����#�#�%������r*c���[5nURU:XaU=RS-
slgURR	X5nU(a
X0lSUlU$)a}Acquire 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.

�)rrHrIrG�acquire)rK�blocking�timeout�me�rcs     r)ra�_RLock.acquire�sP��4�[���;�;�"���K�K�1��K��
�[�[�
 �
 ��
3��
��K��D�K��	r*c���UR[5:wa[S5eURS-
=UlnU(d"SUlURR5 gg)aRelease 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.

�cannot release un-acquired lockr`N)rHr�RuntimeErrorrIrG�release)rKrs  r)rj�_RLock.release�sQ�� �;�;�)�+�%��@�A�A�"�k�k�A�o�-���e���D�K��K�K���!�r*c�$�UR5 g�N�rj�rK�t�v�tbs    r)�__exit__�_RLock.__exit__�������r*c�V�URR5 UuUlUlgrm)rGrarIrH)rK�states  r)�_acquire_restore�_RLock._acquire_restore�s ��������#(� ���T�[r*c��URS:Xa[S5eURnSUlURnSUlURR	5 X4$)Nrrh)rIrirHrGrj)rKrrYs   r)�
_release_save�_RLock._release_save�sR���;�;�!���@�A�A����������������������~�r*c�0�UR[5:H$rm)rHrrJs r)�	_is_owned�_RLock._is_owneds���{�{�i�k�)�)r*c�L�UR[5:wagUR$rE)rHrrIrJs r)�_recursion_count�_RLock._recursion_counts���;�;�)�+�%���{�{�r*)rGrIrHN)T���)�__name__rUrV�__firstlineno__�__doc__rLrZr]ra�	__enter__rjrsrxr{r~r��__static_attributes__r/r*r)rBrB�sA����


��
"�H�I�"�.�
)��*�
r*rBc�v�\rSrSrSrSSjrSrSrSrSr	S	r
S
rSrSSjr
SS
jrSSjrSrSrSrg)r	i
aRClass 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.

Nc�X�Uc
[5nXlURUlURUl[	US5(aUR
Ul[	US5(aURUl[	US5(aURUl[5Ul	g)Nr{rxr~)
r�_lockrarj�hasattrr{rxr~�_deque�_waiters)rK�locks  r)rL�Condition.__init__s����<��7�D��
��|�|����|�|����4��)�)�!%�!3�!3�D���4�+�,�,�$(�$9�$9�D�!��4��%�%�!�^�^�D�N����
r*c�l�URR5 URR5 grm)r�r]r��clearrJs r)r]�Condition._at_fork_reinit+s"���
�
�"�"�$��
�
���r*c�6�URR5$rm)r�r�rJs r)r��Condition.__enter__/s���z�z�#�#�%�%r*c�4�URR"U6$rm)r�rs)rKr?s  r)rs�Condition.__exit__2s���z�z�"�"�D�)�)r*c�J�SUR[UR54-$)Nz<Condition(%s, %d)>)r��lenr�rJs r)rZ�Condition.__repr__5s��$��
�
�C��
�
�4F�'G�G�Gr*c�8�URR5 grm)r�rjrJs r)r{�Condition._release_save8����
�
���r*c�8�URR5 grm)r�ra)rK�xs  r)rx�Condition._acquire_restore;r�r*c�z�URRS5(aURR5 gg)NFT)r�rarjrJs r)r~�Condition._is_owned>s/���:�:���e�$�$��J�J��� ��r*c�t�UR5(d[S5e[5nUR5 URRU5 UR
5nSnUcUR5 SnO*US:�aURSU5nOURS5nUURU5 U(dURRU5 $$![a $f=f!URU5 U(d-URRU5 f![a ff=ff=f)a�Wait 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 lockFTr)
r~rirFrar��appendr{rx�remove�
ValueError)rKrc�waiter�saved_state�gotits     r)�wait�Condition.waitGs��.�~�~����@�A�A��!�������
�
���V�$��(�(�*����	������ ����Q�;�"�N�N�4��9�E�"�N�N�5�1�E���!�!�+�.����M�M�(�(��0���"�����	
�!�!�+�.����M�M�(�(��0��!������sC�)AC0�C � 
C-�,C-�0D7�
D&�%D7�&
D3�0D7�2D3�3D7c��SnUnU"5nU(dKUb'Uc[5U-nOU[5-
nUS::aU$URU5 U"5nU(dMKU$)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)�_timer�)rK�	predicaterc�endtime�waittime�results      r)�wait_for�Condition.wait_forwso�����������#��?�#�g��0�G�&���0�H��1�}���
�
�I�I�h���[�F��&��
r*c�4�UR5(d[S5eURnU(aEUS:�a>USnUR5 US-nUR	U5 U(a	US:�aM<gggg![a N1f=f![
a N/f=f)a#Wake 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 lockrr`N)r~rir�rjr�r�)rK�n�waitersr�s    r)�notify�Condition.notify�s����~�~����B�C�C��-�-���!�a�%��Q�Z�F�	
���� ��Q���
����v�&��!�a�%�g�%�g�� �
�
�
���
��
�s$�A:�B
�:
B�B�

B�Bc�L�UR[UR55 g)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�r�r�rJs r)�
notify_all�Condition.notify_all�s��	
���C��
�
�&�'r*c�X�SSKnUR"S[SS9 UR5 g)zfWake up all threads waiting on this condition.

This method is deprecated, use notify_all() instead.

rNz3notifyAll() is deprecated, use notify_all() insteadr7r8)r:r;r<r��rKr:s  r)�	notifyAll�Condition.notifyAll�s%��	��
�
�K�(�Q�	8����r*)rxr~r�r{r�rarjrm�r`)r�rUrVr�r�rLr]r�rsrZr{rxr~r�r�r�r�r�r�r/r*r)r	r	
sJ��	�!�$�&�*�H����.�`�.�<(�	r*r	c�F�\rSrSrSrS
SjrSrSSjr\rS
Sjr	Sr
S	rg)ri�a3This 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.

c�b�US:a[S5e[[55UlXlg)Nrz$semaphore initial value must be >= 0)r�r	r�_cond�_value)rK�values  r)rL�Semaphore.__init__�s(���1�9��C�D�D��t�v�&��
��r*c	��URnSURSURS[U5SSURS3	$)N�<�.� at �#x�: value=�>)rTrUrVrXr��rK�clss  r)rZ�Semaphore.__repr__�sK���n�n���C�N�N�#�1�S�%5�%5�$6�d�2�d�8�B�-�H��+�+��a�)�	*r*Nc��U(dUb[S5eSnSnUR URS:Xa]U(dOlUb%Uc[5U-nOU[5-
nUS::aODURR	U5 URS:XaM]U=RS-slSnSSS5 U$!,(df   U$=f)aLAcquire 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 acquireFrr`T)r�r�r�r�r�)rKrbrcrer�s     r)ra�Semaphore.acquire�s���0�G�/��M�N�N�
����
�Z�Z��+�+��"����&���"'�'�G�"3��")�E�G�"3��"�a�<�!��
�
����(��+�+��"����q� ������	��Z��	�s�A,B5�B5�5
Cc���US:a[S5eUR U=RU-
slURRU5 SSS5 g!,(df   g=f)z�Release a semaphore, incrementing the internal counter by one or more.

When the counter is zero on entry and another thread is waiting for it
to become larger than zero again, wake up that thread.

r`�n must be one or moreN)r�r�r�r��rKr�s  r)rj�Semaphore.releasesH��
�q�5��4�5�5�
�Z�Z��K�K�1��K��J�J���a� ��Z�Z�s�1A�
A&c�$�UR5 grmrnros    r)rs�Semaphore.__exit__rur*)r�r�r�)TN)r�rUrVr�r�rLrZrar�rjrsr�r/r*r)rr�s(����*�
+�Z�I�!�r*rc�@^�\rSrSrSrSU4SjjrSrSSjrSrU=r	$)ria�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.

c�0>�[TU]U5 Xlgrm)�superrL�_initial_value)rKr�rTs  �r)rL�BoundedSemaphore.__init__)s���
�����#�r*c��URnSURSURS[U5SSURSUR
S3$)Nr�r�r�r�r��/r�)rTrUrVrXr�r�r�s  r)rZ�BoundedSemaphore.__repr__-sY���n�n���C�N�N�#�1�S�%5�%5�$6�d�2�d�8�B�-�H��+�+��a��(;�(;�'<�A�?�	@r*c�"�US:a[S5eUR URU-UR:�a[S5eU=RU-
slURR	U5 SSS5 g!,(df   g=f)aRelease a semaphore, incrementing the internal counter by one or more.

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.

r`r�z!Semaphore released too many timesN)r�r�r�r�r�r�s  r)rj�BoundedSemaphore.release2sj��
�q�5��4�5�5�
�Z�Z��{�{�Q���!4�!4�4� �!D�E�E��K�K�1��K��J�J���a� �	�Z�Z�s�AB�
B)r�r�)
r�rUrVr�r�rLrZrjr��
__classcell__)rTs@r)rrs���� $�@�
!�!r*rc�L�\rSrSrSrSrSrSrSrSr	Sr
S	rS
SjrSr
g
)riEz�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.

c�B�[[55UlSUlg)NF)r	rr��_flagrJs r)rL�Event.__init__Ps���t�v�&��
���
r*c	��URnUR(aSOSnSURSURS[	U5SSUS3	$)	N�set�unsetr�r�r�r�z: r�)rTr�rUrVrX)rKr��statuss   r)rZ�Event.__repr__TsL���n�n���*�*��'���3�>�>�"�!�C�$4�$4�#5�T�"�T�(�2��b���PQ�R�Rr*c�8�URR5 grm)r�r]rJs r)r]�Event._at_fork_reinitYs���
�
�"�"�$r*c��UR$)z5Return true if and only if the internal flag is true.)r�rJs r)�is_set�Event.is_set]s���z�z�r*c�V�SSKnUR"S[SS9 UR5$)ziReturn true if and only if the internal flag is true.

This method is deprecated, use is_set() instead.

rNz+isSet() is deprecated, use is_set() insteadr7r8)r:r;r<r�r�s  r)�isSet�Event.isSetas'��	��
�
�C�(�Q�	8��{�{�}�r*c��UR SUlURR5 SSS5 g!,(df   g=f)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�r�r�rJs r)r��	Event.setls,���Z�Z��D�J��J�J�!�!�#��Z�Z�s	�"8�
Ac�^�UR SUlSSS5 g!,(df   g=f)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�r�rJs r)r��Event.clearws���Z�Z��D�J��Z�Z�s��
,Nc��UR URnU(dURRU5nUsSSS5 $!,(df   g=f)aBlock 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�r�r�)rKrc�signaleds   r)r��
Event.wait�s6���Z�Z��z�z�H���:�:�?�?�7�3���	�Z�Z�s�0A�
Ar�rm)r�rUrVr�r�rLrZr]r�r�r�r�r�r�r/r*r)rrEs0����S�
%��	�	$��r*rc��\rSrSrSrSSjrSrSSjrSrSr	S	r
S
rSrSr
S
r\S5r\S5r\S5rSrg)ri�z�Implements a Barrier.

Useful for synchronizing a fixed number of threads at known synchronization
points.  Threads block on 'wait()' and are simultaneously awoken once they
have all made that call.

Nc��US:a[S5e[[55UlX lX0lXlSUlSUlg)a/Create 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 used as the
default for all subsequent 'wait()' calls.

r`zparties must be > 0rN)	r�r	rr��_action�_timeout�_parties�_staterI)rK�parties�actionrcs    r)rL�Barrier.__init__�sB���Q�;��2�3�3��t�v�&��
����
��
������r*c��URnUR(a*SURSURS[	U5SS3$SURSURS[	U5SSUR
SURS3$)	Nr�r�r�r�z	: broken>z
: waiters=r�r�)rT�brokenrUrVrX�	n_waitingrr�s  r)rZ�Barrier.__repr__�s����n�n���;�;��s�~�~�&�a��(8�(8�'9��b��h�r�]�)�T�T��C�N�N�#�1�S�%5�%5�$6�d�2�d�8�B�-�H� �N�N�+�1�T�\�\�N�!�=�	>r*c���UcURnUR UR5 URnU=RS-
slUS-UR:XaUR5 OUR
U5 UU=RS-slUR5 sSSS5 $!U=RS-slUR5 f=f!,(df   g=f)a&Wait 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'.

Nr`)rr��_enterrIr�_release�_wait�_exit)rKrc�indexs   r)r��Barrier.wait�s����?��m�m�G�
�Z�Z��K�K�M��K�K�E��K�K�1��K�
��1�9��
�
�-��M�M�O��J�J�w�'�����q� ���
�
���Z�����q� ���
�
����Z�s#�2C�6B4�%C�4'C�C�
C,c���URS;a,URR5 URS;aM,URS:a[eURS:Xdeg)N�r�r`r)rr�r�rrJs r)r�Barrier._enter�sO���k�k�W�$��J�J�O�O���k�k�W�$��;�;��?�$�$��{�{�a���r*c��UR(aUR5 SUlURR5 g! UR	5 e=f)Nr`)r�rr�r��_breakrJs r)r�Barrier._release�sA��		��|�|������D�K��J�J�!�!�#��	��K�K�M��s�AA�Ac��^�TRRU4SjU5(dTR5 [eTRS:a[eTRS:Xdeg)Nc�">�TRS:g$rE�rrJs�r)�<lambda>�Barrier._wait.<locals>.<lambda>�s���D�K�K�1�,<r*rr`)r�r�rrr�rKrcs` r)r
�
Barrier._wait�sM����z�z�"�"�#<�g�F�F��K�K�M�$�$��;�;��?�$�$��{�{�a���r*c��URS:Xa3URS;a"SUlURR5 ggg)Nrr)rIrr�r�rJs r)r�
Barrier._exits;���;�;�!���{�{�g�%�����
�
�%�%�'�&�r*c��UR URS:�a0URS:XaSUlOURS:XaSUlOSUlURR5 SSS5 g!,(df   g=f)zuReset the barrier to the initial state.

Any threads currently waiting will get the BrokenBarrier exception
raised.

rr����N)r�rIrr�rJs r)�reset�
Barrier.reset
s`���Z�Z��{�{�Q���;�;�!�#�"$�D�K��[�[�B�&�#%�D�K������J�J�!�!�#��Z�Z�s�A"A8�8
Bc�p�UR UR5 SSS5 g!,(df   g=f)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�rrJs r)�abort�
Barrier.abort!s���Z�Z��K�K�M��Z�Z�s�'�
5c�F�SUlURR5 g)Nr!)rr�r�rJs r)r�Barrier._break+s������
�
���r*c��UR$)z:Return the number of threads required to trip the barrier.)rrJs r)r�Barrier.parties1s���}�}�r*c�<�URS:XaUR$g)z>Return the number of threads currently waiting at the barrier.r)rrIrJs r)r�Barrier.n_waiting6s��
�;�;�!���;�;��r*c� �URS:H$)z0Return True if the barrier is in a broken state.r!rrJs r)r�Barrier.broken?s���{�{�b� � r*)r�r�rIrrr�NNrm)r�rUrVr�r�rLrZr�rrr
rr"r%r�propertyrrrr�r/r*r)rr�su����$>��< �
� �(�$�(� ����������!��!r*rc��\rSrSrSrg)riEr/N)r�rUrVr�r�r/r*r)rrEs��r*rr`c��U[5-$rm)�_counter)�
name_templates r)�_newnamer5Ks���8�:�%�%r*c�8�\rSrSrSrSrSSS.SjjrSSjrSrS	r	S
r
SrSr\
(aS
rSrSrSSjr\S5r\R(S5r\S5r\
(a\S5rSr\S5r\R(S5rSrSrSrSrSrg)riZz�A 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)�daemonc�V�UbS5eUc0nU(a[U5nO$[S5nUbURnUSUS3-
nX lX0lX@lXPlUb(U(a[5(d[S5eX`l
O[5RUl
SUl
[(aSUl[!5Ul[%5UlSUl[*R,Ul[15Ul[4R7U5 g![a N�f=f)a�This 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 a list or tuple of arguments 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 nowz	Thread-%dz (�)z4daemon threads are disabled in this (sub)interpreterT)�strr5r��AttributeError�_target�_name�_args�_kwargs�_daemon_threads_allowedri�	_daemonicr
r7�_ident�_HAVE_THREAD_NATIVE_ID�
_native_id�
_ThreadHandle�_handler�_started�_initializedr,�stderr�_stderr�_make_invoke_excepthook�_invoke_excepthook�	_dangling�add)rK�group�targetrRr?r@r7�target_names        r)rL�Thread.__init__es��.�}�C�C�C�}��>��F���t�9�D��K�(�D��!��"(�/�/�K��b��
�Q�/�/�D����
��
������5�7�7�"�#Y�Z�Z�#�N�+�-�4�4�D�N����!�!�"�D�O�$�������
� ����{�{���"9�";����
�
�d���/&����s�D�
D(�'D(c��URR5 Ub#XlURRU:Xdeggrm)rGr]rBrF�ident�rK�	new_idents  r)�_after_fork�Thread._after_fork�s:���
�
�%�%�'�� �#�K��<�<�%�%��2�2�2�
r*c�~�UR(dS5eSnURR5(aSnURR	5(aSnUR
(aUS-
nURbUSUR--
nSURR<SUR<S	U<S
3$)Nz Thread.__init__() was not called�initial�started�stoppedz daemonz %sr��(z, z)>)
rHrGr�rF�is_donerArBrTr�r=)rKr�s  r)rZ�Thread.__repr__�s���� � �D�"D�D� ����=�=���!�!��F��<�<���!�!��F��>�>��i��F��;�;�"��e�d�k�k�)�)�F��!%���!8�!8�$�*�*�f�M�Mr*c���UR(d[S5eURR5(a[S5e[ U[
U'SSS5 [
URURURS9 URR5 g!,(df   NS=f![a) [ [
U	SSS5 e!,(df   e=ff=f)aStart the thread's activity.

It must be called at most once per thread object. It arranges for the
object's run() method to be invoked in a separate thread of control.

This method will raise a RuntimeError if called more than once on the
same thread object.

zthread.__init__() not calledz threads can only be started onceN)�handler7)rHrirGr��_active_limbo_lock�_limbo�_start_joinable_thread�
_bootstraprFr7�	Exceptionr�rJs r)�start�Thread.start�s���� � ��=�>�>��=�=���!�!��A�B�B�
��F�4�L� �	�"�4�?�?�4�<�<�*.�+�+�
7�	
�
�
���� �
���	�#��4�L�$��$�#���	�s0�
B$� )B5�$
B2�5C(�C�
	C(�
C$	� C(c��URb&UR"UR0URD6 U?U?U?g!U?U?U?f=f)a0Method representing the thread's activity.

You may override this method in a subclass. The standard run() method
invokes the callable object passed to the object's constructor as the
target argument, if any, with sequential and keyword arguments taken
from the args and kwargs arguments, respectively.

N)r<r>r?rJs r)�run�
Thread.run�sG��	7��|�|�'����d�j�j�9�D�L�L�9���d�j�$�,����d�j�$�,�s	�3<�Ac�f�UR5 g! UR(a	[cge=frm)�_bootstrap_innerrAr,rJs r)re�Thread._bootstrap�s+��	��!�!�#��	��~�~�$�,���s��0�0c�"�[5Ulgrm)rrBrJs r)�
_set_ident�Thread._set_ident�s���k��r*c�"�[5Ulgrm)r"rDrJs r)�_set_native_id�Thread._set_native_id�s��+�o�D�Or*c�4�UR5 [(aUR5 URR	5 [
 U[UR'[U	SSS5 [(a[R"[5 [(a[R"[5 UR5 UR!5 g!,(df   Nz=f! URU5 N7=f!UR!5 f=frm)rprCrsrGr�rbrQrBrcr2r,rr&rrjrL�_deleterJs r)rm�Thread._bootstrap_inners���	��O�O��%�%��#�#�%��M�M����#�'+�����$��4�L�$��{��
�
�k�*��}����
�.�
.����
�
�L�L�N�$�#��
.��'�'��-���L�L�N�s7�AD�
C�(AD�;C-�
C*�&D�-D�D�Dc�b�[ [[5	SSS5 g!,(df   g=f)zARemove current thread from the dict of currently running threads.N)rbrQrrJs r)rv�Thread._deletes��
��	��$� �
�
�s� �
.c��UR(d[S5eURR5(d[S5eU[	5La[S5eUb[US5nURRU5 g)a�Wait 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
is_alive() 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.

�Thread.__init__() not calledz'cannot join thread before it is startedzcannot join current threadNr)rHrirGr�r
�maxrF�joinrs  r)r}�Thread.join st��0� � ��=�>�>��}�}�#�#�%�%��H�I�I��>�#�#��;�<�<����'�1�o�G������'�"r*c�J�UR(dS5eUR$)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.

r{)rHr=rJs r)rR�Thread.nameFs#��� � �@�"@�@� ��z�z�r*c�T�UR(dS5e[U5Ulg)Nr{)rHr:r=)rKrRs  r)rRr�Qs"��� � �@�"@�@� ���Y��
r*c�J�UR(dS5eUR$)aThread identifier of this thread or None if it has not been started.

This is a nonzero integer. See the 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.

r{)rHrBrJs r)rT�Thread.identVs#��� � �@�"@�@� ��{�{�r*c�J�UR(dS5eUR$)z�Native integral thread ID of this thread, or None if it has not been started.

This is a non-negative integer. See the get_native_id() function.
This represents the Thread ID as reported by the kernel.

r{)rHrDrJs r)�	native_id�Thread.native_idcs#���$�$�D�&D�D�$��?�?�"r*c��UR(dS5eURR5=(a URR	5(+$)z�Return whether the thread is alive.

This method returns True just before the run() method starts until just
after the run() method terminates. See also the module function
enumerate().

r{)rHrGr�rFr^rJs r)�is_alive�Thread.is_alivensA��� � �@�"@�@� ��}�}�#�#�%�D�d�l�l�.B�.B�.D�*D�Dr*c�J�UR(dS5eUR$)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 only daemon threads are left.

r{)rHrArJs r)r7�
Thread.daemonys#��� � �@�"@�@� ��~�~�r*c���UR(d[S5eU(a[5(d[S5eURR	5(a[S5eXlg)Nr{z/daemon threads are disabled in this interpreterz)cannot set daemon status of active thread)rHrir@rGr�rA)rK�daemonics  r)r7r��sS��� � ��=�>�>��3�5�5��P�Q�Q��=�=���!�!��J�K�K�!�r*c�N�SSKnUR"S[SS9 UR$)zgReturn whether this thread is a daemon.

This method is deprecated, use the daemon attribute instead.

rNz:isDaemon() is deprecated, get the daemon attribute insteadr7r8�r:r;r<r7r�s  r)�isDaemon�Thread.isDaemon�s%��	��
�
�R�(�Q�	8��{�{�r*c�D�SSKnUR"S[SS9 Xlg)zdSet whether this thread is a daemon.

This method is deprecated, use the .daemon property instead.

rNz;setDaemon() is deprecated, set the daemon attribute insteadr7r8r�)rKr�r:s   r)�	setDaemon�Thread.setDaemon�s ��	��
�
�S�(�Q�	8��r*c�N�SSKnUR"S[SS9 UR$)ztReturn a string used for identification purposes only.

This method is deprecated, use the name attribute instead.

rNz7getName() is deprecated, get the name attribute insteadr7r8�r:r;r<rRr�s  r)�getName�Thread.getName�s%��	��
�
�O�(�Q�	8��y�y�r*c�D�SSKnUR"S[SS9 Xlg)zbSet the name string for this thread.

This method is deprecated, use the name attribute instead.

rNz7setName() is deprecated, set the name attribute insteadr7r8r�)rKrRr:s   r)�setName�Thread.setName�s ��	��
�
�O�(�Q�	8��	r*)r>rArFrBrHrLr?r=rDrGrJr<r7rR)NNNr/Nrm)r�rUrVr�r�rHrLrWrZrgrjrerprCrsrmrvr}r0rR�setterrTr�r�r7r�r�r�r�r�r/r*r)rrZs�����L�59�!%�9�15�9�v
�N��87�"�("��	.��,%�$#�L����
�[�[�����	��	��	�	#�
�	#�	E������]�]�"��"�	�	�	�	r*r)�_excepthook�_ExceptHookArgs)�print_exception)�
namedtuplerz'exc_type exc_value exc_traceback threadc��[U6$rm)r�)r?s r)rr�s
����%�%r*c��UR[:Xag[b"[Rb[RnO)URbURR
nUcgOgURbURRnO
[5n[SUS3USS9 [URURURUS9 UR5 g)z)
Handle uncaught Thread.run() exception.
NzException in thread �:T��file�flush)r�)
�exc_type�
SystemExitr,rI�threadrJrRr�print�_print_exception�	exc_value�
exc_tracebackr�)r?rIrRs   r)rr�s����=�=�J�&������� 7��[�[�F�
�[�[�
$��[�[�(�(�F��~���
��;�;�"��;�;�#�#�D��;�D�
�$�T�F�!�,���	'���������8J�8J�$�	&����r*c�^^^^^�[m[RmTc[S5eTc[S5e[Rm[m[mUUUUU4SjnU$)Nzthreading.excepthook is Nonezsys.excepthook is Nonec�Z>�[nUcTn[/T
"5QUP5nU"U5 Sng![alnSUlATbTRb
TRnOUR
nT"SUSS9 TbTRb
TRnOT	nU"T
"56 SnANtSnAff=f!Snf=f)NTz"Exception in threading.excepthook:r�)rrrf�__suppress_context__rIrJ)r��hookr?�excrI�sys_excepthook�local_print�	local_sys�old_excepthook�old_sys_excepthook�sys_exc_infos      �����r)�invoke_excepthook�2_make_invoke_excepthook.<locals>.invoke_excepthooks����	��D��|�%��!�";�L�N�";�F�";�<�D���J�*�D��)�	,�'+�C�$���$��)9�)9�)E�"�)�)�������<�#�4�
1��$��)=�)=�)I�!*�!5�!5��!3���L�N�+��#	,��(�D�s'�'-�
B#�A"B�B&�B#�#B&�&B*)rr,ri�exc_infor�)r�r�r�r�r�r�s @@@@@r)rKrK�s^���
 �N��������9�:�:��!��3�4�4��=�=�L��K��I���@�r*c�.�\rSrSrSrSSjrSrSrSrg)	ri&z�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

Nc��[RU5 XlX lUbUO/UlUbUO0Ul[
5Ulgrm)rrL�interval�functionr?r@r�finished)rKr�r�r?r@s     r)rL�Timer.__init__/s=������� �
� �
� �,�D�"��	� &� 2�f�������
r*c�8�URR5 g)z)Stop the timer if it hasn't finished yet.N)r�r�rJs r)�cancel�Timer.cancel7s���
�
���r*c��URRUR5 URR5(d&UR"UR
0URD6 URR5 grm)r�r�r�r�r�r?r@r�rJs r)rj�	Timer.run;sT���
�
���4�=�=�)��}�}�#�#�%�%��M�M�4�9�9�4����4��
�
���r*)r?r�r�r�r@r/)	r�rUrVr�r�rLr�rjr�r/r*r)rr&s��� ��r*rc��\rSrSrSrSrg)�_MainThreadiDc�P�[RUSSS9 URR5 [	5Ul[
UR
5Ul[(aUR5 [ U[UR
'SSS5 g!,(df   g=f)N�
MainThreadF�rRr7)rrLrGr��_get_main_thread_identrB�_make_thread_handlerFrCrsrbrQrJs r)rL�_MainThread.__init__Fsm������<���>��
�
����,�.���*�4�;�;�7���!�!����!�
�#'�G�D�K�K� � �
�
�s�:B�
B%)rFrBN)r�rUrVr�rLr�r/r*r)r�r�Ds��(r*r�c�$�\rSrSrSrSrSrSrg)�_DeleteDummyThreadOnDeliVzJ
Helper class to remove a dummy thread from threading._active on __del__.
c�H�XlURUlU[lgrm)�
_dummy_threadrT�_tident�_thread_local_info�_track_dummy_thread_ref)rK�dummy_threads  r)rL� _DeleteDummyThreadOnDel.__init__[s ��)��#�)�)���6:��2r*c���[ [RUR5URLa [RURS5 SSS5 g!,(df   g=frm)rbrQ�getr�r��poprJs r)�__del__�_DeleteDummyThreadOnDel.__del__fs>��
��{�{�4�<�<�(�D�,>�,>�>����D�L�L�$�/� �
�
�s�A
A�
A+)r�r�N)r�rUrVr�r�rLr�r�r/r*r)r�r�Vs���	:�0r*r�c�4�\rSrSrSrSrSSjrSSjrSrg)	�_DummyThreadisc��[RU[S5[5S9 URR5 UR
5 [UR5Ul	[(aUR5 [ U[UR'SSS5 [U5 g!,(df   N=f)NzDummy-%dr�)rrLr5r@rGr�rpr�rBrFrCrsrbrQr�rJs r)rL�_DummyThread.__init__us�������8�J�#7�6�8�	�	:��
�
��������*�4�;�;�7���!�!����!�
�#'�G�D�K�K� � ���%� �
�s�B4�4
Cc��URR5(d URR5(ag[	S5e)NTzthread is not alive)rFr^rGr�rirJs r)r��_DummyThread.is_alive�s6���|�|�#�#�%�%�$�-�-�*>�*>�*@�*@���0�1�1r*Nc��[S5e)Nzcannot join a dummy thread)rirs  r)r}�_DummyThread.join�s���7�8�8r*c�b�Ub[UlSUlSUl[RXS9 g)Nr�F�rV)r�rTr=rArrWrUs  r)rW�_DummyThread._after_fork�s.��� �(�D�N�%�D�J�"�D�N����4��5r*)rTrArFr=rm)	r�rUrVr�rLr�r}rWr�r/r*r)r�r�ss��
&�2�
9�6r*r�c�Z�[[5$![a
 [5s$f=f)z�Return the current Thread object, corresponding to the caller's thread of control.

If the caller's thread of control was not created through the threading
module, a dummy thread object with limited functionality is returned.

)rQrrSr�r/r*r)r
r
�s+����y�{�#�#�����~���s��*�*c�J�SSKnUR"S[SS9 [5$)z�Return the current Thread object, corresponding to the caller's thread of control.

This function is deprecated, use current_thread() instead.

rNz;currentThread() is deprecated, use current_thread() insteadr7r8)r:r;r<r
�r:s r)�
currentThreadr��s$����M�M�O�$��4���r*c��[ [[5[[5-sSSS5 $!,(df   g=f)z�Return the number of Thread objects currently alive.

The returned count is equal to the length of the list returned by
enumerate().

N)rbr�rQrcr/r*r)rr�s#��
��7�|�c�&�k�)�
�	�	�s�0�
>c�J�SSKnUR"S[SS9 [5$)zpReturn the number of Thread objects currently alive.

This function is deprecated, use active_count() instead.

rNz7activeCount() is deprecated, use active_count() insteadr7r8)r:r;r<rr�s r)�activeCountr��s#����M�M�K�$��4��>�r*c�x�[[R55[[R55-$rm)�listrQ�valuesrcr/r*r)�
_enumerater��s$������ �!�D�����$9�9�9r*c��[ [[R55[[R55-sSSS5 $!,(df   g=f)z�Return a list of all Thread objects currently alive.

The list includes daemonic threads, dummy thread objects created by
current_thread(), and the main thread. It excludes terminated threads and
threads that have not yet been started.

N)rbr�rQr�rcr/r*r)rr�s2��
��G�N�N�$�%��V�]�]�_�(=�=�
�	�	�s�;A�
Ac�l^^^�[(a[S5e[RUUU4Sj5 g)a�CPython internal: register *func* to be called before joining threads.

The registered *func* is called with its arguments just before all
non-daemon threads are joined in `_shutdown()`. It provides a similar
purpose to `atexit.register()`, but its functions are called prior to
threading shutdown instead of interpreter shutdown.

For similarity to atexit, the registered functions are called in reverse.
z$can't register atexit after shutdownc�>�T"T0TD6$rmr/)�argr(r@s���r)r�"_register_atexit.<locals>.<lambda>�s���d�C�&:�6�&:r*N)�_SHUTTING_DOWNri�_threading_atexitsr�)r(r�r@s```r)�_register_atexitr��s%����~��A�B�B����:�;r*)rc��[RR5(a[5(agSq[[5H
nU"5 M [5(a[RR5 [5 g)zK
Wait until the Python thread state of all non-daemon threads get deleted.
NT)	�_main_threadrFr^�_is_main_interpreterr��reversedr��	_set_done�_thread_shutdown)�atexit_calls r)�	_shutdownr�sh�����#�#�%�%�*>�*@�*@���N� � 2�3���
�4�������&�&�(��r*c��[$)z�Return the main thread object.

In normal conditions, the main thread is the thread from which the
Python interpreter was started.
)r�r/r*r)rrs
���r*c�&�[5q0n[[5nUq[ [[55nUR[5 UH6nX1La[5nURUS9 X0U'M&UR5 M8 [R5 [R5 [RU5 [[5S:XdeSSS5 g![a
 [5nN�f=f!,(df   g=f)zD
Cleanup threading module state that should not exist after a fork.
r�r`N)rrbrQrrSr�r�r�r��updaterMrWrcr�r�)�
new_active�current�threadsr�rTs     r)rWrWs�������J� ��)�+�&���L�	��j�l�#�����y�!��F�� �!����"�"�U�"�3�$*�5�!��"�"�$��	�����
�
�����z�"��7�|�q� � � �)
�	��� ��-��	 ��
�	�s�C(�B7D�(C?�>C?�
D�register_at_fork)�after_in_child)hr��os�_os�sysr,�_threadr:�timerr��_weakrefsetr�	itertoolsrrI�_collectionsrr��ImportError�collections�__all__�start_joinable_threadrd�daemon_threads_allowedr@�
allocate_lockrF�LockType�	_LockTyperrr�rErr�r�r"rCr�r;�errorrrr=r
r#r�_threading_localr&r2rr rrr!rrrBr>r	rrrrrir�__next__r3r5rbrQrcrMrr�rr�r�	tracebackr�r�r��__excepthook__rKrr�r�r�r�r
r�rr�r�rr�r�r�rr�rrWr�r	r/r*r)�<module>r s��A�����#��%�,�,�<��!�6�6��!�8�8���&�&�����	��$�$���1�1���%�%�
����	� �7�7���3�3��#��)�)�M�!���N�N�?�#��m�m����m�m�G��!�!���
'�'��
����%���#����$�&{�{�z��q�q�hT�T�n*!�y�*!�ZO�O�z`!�`!�F	��	�
�!�9����&��W��
��	���I�	�
b�b�J+�<�\��0�j�F��<
(�&�
(��W��0�0�:6�6�6�@
�	�
*�	�:�	>�����
<� ��}���6�*!�Z�3�"�#�#�����4�$��c1�,�+�+�,��H�#�"��#��
���G����'�&�&�'��D$�(�=�&� ��1�3�O�&��(�sY�H�)H1�I�/I�I"�H.�-H.�1H=�<H=�I�I�I�I�"!J�J

?>