Files
952-11/env/python/dll/Python312/Lib/__pycache__/threading.cpython-312.pyc
T

549 lines
64 KiB
Plaintext
Raw Normal View History

2024-08-19 17:05:14 +08:00
Ë
*åf…ñãó—dZddlZddlZddlZddlZddlmZ ddl
m Z ddl m
Z ddlmZgd¢Zej*Zej.Zej2Zej6Zej8Z ej:Z ej>Zd Z ejCd
«ejDZ# ejHZ%ejLZ&[da'da(d „Z)d
„Z*d„Z+d„Z,d„Z-d„Z.eZ/d„Z$Gd„d«Z0e0Z1Gd„d«Z2Gd„d«Z3Gd„de3«Z4Gd„d«Z5Gd„d«Z6Gd„d e7«Z8ed!«jrZ:d"„Z;e$«a<iZ=iZ>e «Z?e«a@eA«aBd#„ZCGd$„d%«ZD dd&lmEaFmGZHtŒZMd-„ZNGd.„d/eD«ZOGd0„d1eD«ZPGd2„d3eD«ZQd4„ZRd5„ZSd6„ZTd7„ZUd8„ZVd9„ZWgZXd aYd:„ZZdd;lm[Z[eP«a\d<„Z]d=„Z^ dd>lm_Z`d@„ZbecedA«rejÈeb¬B«yy#e$r
ddlmZY�ŒÏwxYw#e$rd„ZY�Œ‘wxYw#e$rd Z Y�ŒwxYw#e$rdZ%Y�ŒtwxYw#e$rdd'lImJZKdd(lmLZLeLd)d*«ZGd+„ZHd,„aFYŒÝwxYw#e$r dd?lam`Z`YŒ‘wxYw)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_threadscó—y©NT©r$óúEC:\Users\RCi\AppData\Local\Programs\Python\Python312\Lib\threading.pyÚ_is_main_interpreterr'4s€Ør%TÚ
get_native_idFcó—|ay)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 r&rrJs €ð�Mr%cóD—t|«tj|«y)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 Ss€ôˆtÔÜ×јtÕ$r%có—tS)z;Get the profiler function as set by threading.setprofile().r*r$r%r&rr]s€ä Ðr%có—|ay)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&rras €ð�Kr%cóD—t|«tj|«y)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!js€ô
ˆT„NÜ×јTÕ"r%có—tS)z6Get the trace function as set by threading.settrace().r3r$r%r&rrts€ä Ðr%có:—t€ t|i|¤ŽSt|i|¤Ž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.
)Ú_CRLockÚ_PyRLock)ÚargsÚkwargss r&rr|s)€ô€Ü˜Ð( Ñ(Ð(Ü �DÐ #˜FÑ #Ð#r%cóR—eZdZdZd„Zd„Zd„Zd
d„ZeZd„Z d„Z
d„Z d „Z d
„Z
d „Zy )Ú_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.
có>—t«|_d|_d|_y©Nr)Ú_allocate_lockÚ_blockÚ_ownerÚ_count©Úselfs r&Ú__init__z_RLock.__init__“s€Ü$Ó&ˆŒ ؈Œ ؈� r%c ó6—|j} t|j}d|jj «rdnd|j j|j j||jtt|««fzS#t$rYŒvwxYw)Nz)<%s %s.%s object owner=%r count=%d at %s>ÚlockedÚunlocked) rCÚ_activeÚnameÚKeyErrorrBrIÚ __class__Ú
__module__Ú __qualname__rDÚhexÚid)rFÚowners r&Ú__repr__z_RLock.__repr__˜sŠ€Ø— ‘ ˆð ܘE‘N×'Ñ'ˆEð;ØŸ ™ ×*Ñ*Ô,‰H°*Ø �N‰N× %Ñ %Ø �N‰N× 'Ñ 'Ø Ø �K‰KÜ ”�4“‹Mð
>
ñ
ð
øôò Ù ð úsŽB  BÂBcóT—|jj«d|_d|_yr@)rBÚ_at_fork_reinitrCrDrEs r&rVz_RLock._at_fork_reinit§s €Ø � ‰ ×#Ñ#Ô%؈Œ ؈� r%có¼—t«}|j|k(r|xjdz
c_y|jj ||«}|r||_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.
é)rrCrDrBÚacquire)rFÚblockingÚtimeoutÚmeÚrcs r&rYz_RLock.acquire¬sT€ô4‹[ˆØ �;‰;˜"Ò Ø �KŠK˜1Ñ �KØØ
�[‰[×
Ñ
 ¨7Ó
3ˆÙ
؈DŒK؈DŒK؈ r%có¼—|jt«k7r td«‚|jdz
x|_}|s"d|_|jj «yy)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.
úcannot release un-acquired lockrXN)rCrÚ RuntimeErrorrDrBÚrelease)rFrs r&raz_RLock.releaseÒsQ€ð �;‰;œ)›+Ò %ÜÐ@ÓAÐ AØ"Ÿk™k¨A™oÐ-ˆŒ �eÙØˆDŒKØ �K‰K× Ñ Õ !ðr%có$—|j«y©N©ra©rFÚtÚvÚtbs r&Ú__exit__z_RLock.__exit__éó €Ø � ‰ �r%cóV—|jj«|\|_|_yrc)rBrYrDrC)rFÚstates r&Ú_acquire_restorez_RLock._acquire_restoreîs €Ø � ‰ ×ÑÔØ#(Ñ ˆŒ �T•[r%có¾—|jdk(r td«‚|j}d|_|j}d|_|jj «||fS)Nrr_)rDr`rCrBra)rFrrSs r&Ú
_release_savez_RLock._release_saveòsT€Ø �;‰;˜!Ò ÜÐ@ÓAÐ AØ— ‘ ˆØˆŒ Ø— ‘ ˆØˆŒ Ø � ‰ ×ÑÔØ�uˆ~Ðr%có0—|jt«k(Src)rCrrEs r&Ú _is_ownedz_RLock._is_ownedüs€Ø�{‰{œi›kÑ)Ð)r%cóJ—|jt«k7ry|jSr@)rCrrDrEs r&Ú_recursion_countz_RLock._recursion_counts€Ø �;‰;œ)›+Ò %ØØ�{‰{Ðr%N©Téÿÿÿÿ)Ú__name__rOrPÚ__doc__rGrTrVrYÚ __enter__rarirmrorqrsr$r%r&r>r>‰sA„ñòò

òó
"ðH€Iò"ò.ò
)òò*ó
r%r>cóf—eZdZdZdd„Zd„Zd„Zd„Zd„Zd„Z d „Z
d
„Z dd „Z dd „Z
dd
„Zd„Zd„Zy)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.
Ncó:—|€
t«}||_|j|_|j|_t |d«r|j
|_t |d«r|j |_t |d«r|j|_t«|_ y)Nrormrq)
rÚ_lockrYraÚhasattrrormrqÚ_dequeÚ_waiters©rFÚlocks r&rGzCondition.__init__s|€Ø ˆ<Ü“7ˆD؈Œ
à—|‘|ˆŒ Ø—|‘|ˆŒ ô �4˜Ô )Ø!%×!3Ñ!3ˆDÔ Ü �4Ð+Ô ,Ø$(×$9Ñ$9ˆDÔ !Ü �4˜Ô %Ø!Ÿ^™^ˆDŒNÜ›ˆ�
r%cól—|jj«|jj«yrc)r{rVr~ÚclearrEs r&rVzCondition._at_fork_reinit's"€Ø �
‰
×"Ñ"Ô$Ø �
‰
×ÑÕr%có6—|jj«Src)r{rxrEs r&rxzCondition.__enter__+s€Ø�z‰z×#Ñ#Ó%Ð%r%có4—|jj|ŽSrc)r{ri)rFr;s r&rizCondition.__exit__.s€Ø"ˆt�z‰z×"Ñ" DÐ)Ð)r%cóJ—d|jt|j«fzS)Nz<Condition(%s, %d)>)r{Úlenr~rEs r&rTzCondition.__repr__1s€Ø$¨¯
©
´C¸¿
¹
Ó4FÐ'GÑGÐGr%có8—|jj«yrc)r{rarEs r&rozCondition._release_save4ó€Ø �
‰
×ÑÕr%có8—|jj«yrc)r{rY)rFÚxs r&rmzCondition._acquire_restore7rˆr%cóp—|jjd«r|jj«yy)NFT)r{rYrarEs r&rqzCondition._is_owned:s,€ð �:‰:× Ñ ˜eÔ $Ø �J‰J× Ñ Ô Øàr%cóN—|j«s td«‚t«}|j«|jj |«|j
«}d} |€|j«d}n)|dkDr|jd|«}n|jd«}||j|«|s |jj|«SS#t$rYSwxYw#|j|«|s, |jj|«w#t$rYwwxYwwxYw)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 lockFTr)
rqr`rArYr~ÚappendrormÚremoveÚ
ValueError)rFr[ÚwaiterÚ saved_stateÚgotits r&ÚwaitzCondition.waitCs€ð.�~‰~ÔÜÐ@ÓAÐ AÜÓ!ˆØ�‰ÔØ �
‰
×јVÔ$Ø×(Ñ(Ó*ˆ Øˆð ØˆØ—‘Ô Ø‘à˜Q’;Ø"ŸN™N¨4°Ó9‘Eà"ŸN™N¨5Ó1�EØà × !Ñ ! +Ô .ÙðØ—M‘M×(Ñ(¨Õ0ðøô"òÙðûð
× !Ñ ! +Ô .ÙðØ—M‘M×(Ñ(¨Õ0øÜ!òÙðúðúsBÁ$?C#Â7Cà C ÃC Ã#D$Ã8DÄD$Ä D ÄD$ÄD Ä D$có¤—d}|}|«}|sB|�%|€t«|z}n|t«z
}|dkr |S|j|«|«}|sŒB|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)Ú_timer“)rFÚ predicater[ÚendtimeÚwaittimeÚresults r&Úwait_forzCondition.wait_forssm€ðˆØˆÙ“ˆÙØÐ#Ø�?Ü#›g¨Ñ0‘Gà&¬«Ñ0�HØ 1’}Øðˆ
ð
�I‰I�hÔ Ù“[ˆFòðˆ
r%có —|j«s td«‚|j}|r=|dkDr7|d} |j«|dz} |j |«|r|dkDrŒ5yyyy#t$rYŒ)wxYw#t
$rYŒ&wxYw)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 lockrrXN)rqr`r~rarŽr�)rFÚnÚwaitersr�s r&ÚnotifyzCondition.notifyŠsš€ð�~‰~ÔÜÐBÓCÐ CØ—-‘-ˆÙ˜!˜aš%ؘQ‘ZˆFð
Ø—‘Ô ð�Q‘�ð
Ø—‘˜vÔ&ñ˜!˜aœ%ˆg˜%ˆgøô ò
ñ
ð 
ûôò
Ùð
ús#µA(Á A7Á( A4Á3A4Á7 BÂBcóL—|jt|j««y)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~rEs r&Ú
notify_allzCondition.notify_all¨s€ð
� ‰ ”C˜Ÿ
™
Ó&Õ'r%có\—ddl}|jdtd¬«|j«y)zvWake up all threads waiting on this condition.
This method is deprecated, use notify_all() instead.
rNz3notifyAll() is deprecated, use notify_all() insteadé©Ú
stacklevel)ÚwarningsÚwarnÚDeprecationWarningr ©rFr¥s r&Ú notifyAllzCondition.notifyAll±s*€ó Ø�
‰
ÐKÜ(°Qð ô 8à �‰Õr%rc©rX)rvrOrPrwrGrVrxrirTrormrqr“ršržr r©r$r%r&r r sJ„ñ ó!ò$ò&ò*òHòòòó.ó`ó.ò<(ó r%r có8—eZdZdZdd„Zd„Zd d„ZeZdd„Zd„Z y)
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.
cób—|dkr td«‚tt««|_||_y)Nrz$semaphore initial value must be >= 0)r�r rÚ_condÚ_value)rFÚvalues r&rGzSemaphore.__init__És*€Ø �1Š9ÜÐCÓDÐ DÜœt›vÓ&ˆŒ
؈� r%c óˆ—|j}d|j›d|j›dt|«d›d|j›d� S)Nú<ú.ú at ú#xú: value=ú>)rNrOrPrRr®©rFÚclss r&rTzSemaphore.__repr__ÏsK€Ø�n‰nˆØ�C—N‘NÐ# 1 S×%5Ñ%5Ð$6°d¼2¸d»8ÀB¸-ðHØŸ+™+˜ að)ð *r%Ncób—|s
|� td«‚d}d}|j5|jdk(rS|sng|�#|€t«|z}n|t«z
}|dkrnB|jj |«|jdk(rŒS|xjdzc_d}ddd«|S#1swY|SxYw)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 acquireFrrXT)r�r­r®r•r“)rFrZr[r]r—s r&rYzSemaphore.acquireÔs¹€ñ0˜GÐ/ÜÐMÓNÐ NØ
ˆØˆØ
�Z‰Zñ Ø—+‘+ Ò"ÙØØÐ&Ø�Ü"'£'¨GÑ"3™à")¬E«GÑ"3˜Ø" aš<Ø!Ø—
‘
—‘ Ô(ð—+‘+ Ó"ð— ’ ˜qÑ • Ø�÷ ðˆ ÷ ðˆ ús A"B$ÂB$Â$B.cóÆ—|dkr td«‚|j5|xj|z
c_|jj|«ddd«y#1swYyxYw)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.
rXún must be one or moreN)r�r­r®rž©rFrœs r&razSemaphore.releasesS€ð
ˆqŠ5ÜÐ4Ó5Ð 5Ø
�Z‰Zñ !Ø �KŠK˜1Ñ �KØ �J‰J× Ñ ˜aÔ ÷ !÷ !ñ !ús �1AÁA có$—|j«yrcrdres r&rizSemaphore.__exit__rjr%rª)TN)
rvrOrPrwrGrTrYrxrarir$r%r&rr½s(„ñóò *ó
+ðZ€Ió !ór%rcó2‡—eZdZdZdˆfd„ Zd„Zdd„ZˆxZS)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.
có2•—t‰|�|«||_yrc)ÚsuperrGÚ_initial_value)rFr¯rNs €r&rGzBoundedSemaphore.__init__%sø€Ü
‰Ñ˜ÔØ#ˆÕr%c ó¢—|j}d|j›d|j›dt|«d›d|j›d|j
›d� S)Nr±r²r³r´rµú/r¶)rNrOrPrRr®rÁr·s r&rTzBoundedSemaphore.__repr__)sY€Ø�n‰nˆØ�C—N‘NÐ# 1 S×%5Ñ%5Ð$6°d¼2¸d»8ÀB¸-ðHØŸ+™+˜ a¨×(;Ñ(;Ð'<¸Að?ð @r%có—|dkr td«‚|j5|j|z|jkDr td«‚|xj|z
c_|jj |«ddd«y#1swYyxYw)a>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.
If the number of releases exceeds the number of acquires,
raise a ValueError.
rXr»z!Semaphore released too many timesN)r�r­r®rÁržr¼s r&razBoundedSemaphore.release.su€ð
ˆqŠ5ÜÐ4Ó5Ð 5Ø
�Z‰Zñ !Ø�{‰{˜Q‰ ×!4Ñ!4Ò4Ü Ð!DÓEÐEØ �KŠK˜1Ñ �KØ �J‰J× Ñ ˜aÔ ÷  !÷ !ñ !ús �AA>Á>Brª)rvrOrPrwrGrTraÚ
__classcell__)rNs@r&rrsø„ñõ $ò@÷
!r%rcóB—eZdZdZd„Zd„Zd„Zd„Zd„Zd„Z d„Z
d d
„Z y ) rzò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—tt««|_d|_y)NF)r rr­Ú_flagrEs r&rGzEvent.__init__Ls€Üœt›vÓ&ˆŒ
؈�
r%c ó”—|j}|jrdnd}d|j›d|j›dt |«d›d|›d� S) NÚsetÚunsetr±r²r³r´z: r¶)rNrÈrOrPrR)rFr¸Ústatuss r&rTzEvent.__repr__PsL€Ø�n‰nˆØŸ*š*‘¨'ˆØ�3—>‘>Ð" ! C×$4Ñ$4Ð#5°T¼"¸T»(À2¸ÀbÈÈÐPQÐRÐRr%có8—|jj«yrc)r­rVrEs r&rVzEvent._at_fork_reinitUs€à �
‰
×"Ñ"Õ$r%có—|jS)z5Return true if and only if the internal flag is true.)rÈrEs r&Úis_setz Event.is_setYs €à�z‰zÐr%cóZ—ddl}|jdtd¬«|j«S)zyReturn 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() insteadr¢r£)r¥r¦r§rÏr¨s r&ÚisSetz Event.isSet]s,€ó Ø�
‰
ÐCÜ(°Qð ô 8à�{‰{‹}Ðr%cóˆ—|j5d|_|jj«ddd«y#1swYyxYw)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 rEs r&rÊz Event.seths7€ð�Z‰Zñ $؈DŒJØ �J‰J× !Ñ !Ô #÷ $÷ $ñ $ús �"8¸AcóT—|j5d|_ddd«y#1swYyxYw)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ÈrEs r&r‚z Event.clearss'€ð�Z‰Zñ ؈DŒJ÷ ÷ ñ ús�ž'Ncóœ—|j5|j}|s|jj|«}|cddd«S#1swYyxYw)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­rÈr“)rFr[Úsignaleds r&r“z
Event.wait}sA€ð�Z‰Zñ Ø—z‘zˆHÙØŸ:™:Ÿ?™?¨7Ó3�Ø÷  ÷ ò ús �+AÁA rc) rvrOrPrwrGrTrVrÏrÑrÊr‚r“r$r%r&rrAs0„ñòòSò
%òò ò $òôr%rcó€—eZdZdZdd„Zd„Zdd„Zd„Zd„Zd„Z d „Z
d
„Z d „Z d „Z
ed
„«Zed„«Zed„«Zy)rzØ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óz—tt««|_||_||_||_d|_d|_y)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 used as the
default for all subsequent 'wait()' calls.
rN)r rr­Ú_actionÚ_timeoutÚ_partiesÚ_staterD)rFÚpartiesÚactionr[s r&rGzBarrier.__init__§s5€ôœt›vÓ&ˆŒ
؈Œ ؈Œ
؈Œ
؈Œ ؈� r%c ó—|j}|jr*d|j›d|j›dt |«d›d�Sd|j›d|j›dt |«d›d|j
›d|j ›d� S) Nr±r²r³r´z : broken>z
: waiters=rÃr¶)rNÚbrokenrOrPrRÚ n_waitingrÜr·s r&rTzBarrier.__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óЗ|€ |j}|j5|j«|j}|xjdz
c_ |dz|jk(r|j «n|j
|«||xjdzc_|j«cddd«S#|xjdzc_|j«wxYw#1swYyxYw)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'.
NrX)rÙr­Ú_enterrDrÚÚ_releaseÚ_waitÚ_exit)rFr[Úindexs r&r“z 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Ñ • à—
‘
” ÷ ñ øð— ’ ˜qÑ • à—
‘
• ú÷ ð ús#›2CÁ5B2Â%CÂ2'CÃCÃC%có¾—|jdvr)|jj«|jdvrŒ)|jdkrt‚|jdk(sJ‚y)N©rurXr)rÛr­r“rrEs r&râzBarrier._enterÜsO€Ø�k‰k˜WÑ$à �J‰J�O‰OÔ ð�k‰k˜WÒ$ð �;‰;˜Š?Ü$Ð $Ø�{‰{˜aÒÐÑr%có¬— |jr|j«d|_|jj«y#|j «‚xYw)NrX)rØrÛr­r Ú_breakrEs r&rãzBarrier._releaseçsA€ð Ø�|Š|Ø— ‘ ”àˆDŒKØ �J‰J× !Ñ !Õ #øð à �K‰KŒMØ ús ‚=AÁAc󼇗‰jjˆfd„|«s‰j«t‚‰jdkrt‚‰jdk(sJ‚y)Ncó"•—‰jdk7Sr@©rÛrEs€r&ú<lambda>zBarrier._wait.<locals>.<lambda>ösø€¨D¯K©K¸1Ñ,<€r%rrX)r­ršrêrrÛ©rFr[s` r&räz
Barrier._waitõsJø€Ø�z‰z×"Ñ"Ó#<¸gÔFà �K‰KŒMÜ$Ð $Ø �;‰;˜Š?Ü$Ð $Ø�{‰{˜aÒÐÑr%có„—|jdk(r1|jdvr"d|_|jj«yyy)Nrrè)rDrÛr­r rEs r&råz
Barrier._exits;€Ø �;‰;˜!Ò Ø�{‰{˜gÑ%à�” Ø—
‘
×%Ñ%Õ'ð&ð r%có—|j5|jdkDr.|jdk(rd|_n|jdk(rd|_nd|_|jj«ddd«y#1swYyxYw)z�Reset the barrier to the initial state.
Any threads currently waiting will get the BrokenBarrier exception
raised.
rruéþÿÿÿN)r­rDrÛr rEs r&Úresetz
Barrier.resetsj€ð�Z‰Zñ $Ø�{‰{˜QŠØ—;‘; !Ò#à"$�D•KØ—[‘[ BÒ&ð#%�D•Kà�” Ø �J‰J× !Ñ !Ô #÷ $÷ $ñ $ús �AA5Á5A>cóf—|j5|j«ddd«y#1swYyxYw)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­rêrEs r&Úabortz
Barrier.aborts)€ð�Z‰Zñ Ø �K‰KŒM÷ ÷ ñ ús�'§0cóF—d|_|jj«y)Nrò)rÛr­r rEs r&rêzBarrier._break%s€ðˆŒ Ø �
‰
×ÑÕr%có—|jS)z:Return the number of threads required to trip the barrier.)rÚrEs r&rÜzBarrier.parties+s€ð�}‰}Ðr%có:—|jdk(r |jSy)z>Return the number of threads currently waiting at the barrier.r)rÛrDrEs r&ràzBarrier.n_waiting0s€ð
�;‰;˜!Ò Ø—;‘;Ð Ør%có —|jdk(S)z0Return True if the barrier is in a broken state.ròrírEs r&rßzBarrier.broken9s€ð�{‰{˜bÑ Ð r%©NNrc)rvrOrPrwrGrTr“rârãrärårórõrêÚpropertyrÜràrßr$r%r&rržsu„ñóò >óò< ò
ò ò(ò$ò(ò ð ñóððñóððñ!óñ!r%rcó —eZdZy)rN)rvrOrPr$r%r&rr?s„Ør%rrXcó—|t«zSrc)Ú_counter)Ú
name_templates r&Ú_newnamerEs€Ø œ8›:Ñ %Ð%r%có€—tD�cgc]}|j«rŒ|‘Œ}}tj|«ycc}w)a!
Drop any shutdown locks that don't correspond to running threads anymore.
Calling this from time to time avoids an ever-growing _shutdown_locks
set when Thread objects are not joined explicitly. See bpo-37788.
This must be called with _shutdown_locks_lock acquired.
N)Ú_shutdown_locksrIÚdifference_update)r€Ú to_removes r&Ú_maintain_shutdown_locksrWs3€ô#2ÖG˜$¸¿¹½’ÐG€IÐGÜ×%Ñ% iÕ0ùòHs‰;Ÿ;có&—eZdZdZdZ dddœd„Zd„Zd„Zd„Zd „Z d
„Z
d „Z e rd „Z
d
„Zd„Zd„Zd„Zdd„Zd d„Zed„«Zej,d„«Zed„«Ze red„«Zd„Zed„«Zej,d„«Zd„Zd„Zd„Zd„Zy)!raA 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ó,—|�Jd«‚|€i}|r t|«}n#td«}|� |j}|d|›d�z
}||_||_||_||_|�|rt«s td«‚||_
nt«j|_
d|_
trd|_d|_t#«|_d|_d|_t*j,|_t1«|_t4j7|«y#t$rYŒÓwxYw) aUThis 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)interpreterFT)ÚstrrrvÚAttributeErrorÚ_targetÚ_nameÚ_argsÚ_kwargsÚ_daemon_threads_allowedr`Ú _daemonicr
rÚ_identÚ_HAVE_THREAD_NATIVE_IDÚ
_native_idÚ _tstate_lockrÚ_startedÚ _is_stoppedÚ _initializedr/ÚstderrÚ_stderrÚ_make_invoke_excepthookÚ_invoke_excepthookÚ _danglingÚadd)rFÚgroupÚtargetrLr;r<rÚ target_names r&rGzThread.__init__rs€ð.ˆ}ÐCÐCÓCˆ}Ø ˆ>؈FÙ Ü�t“9‰Dä˜KÓ(ˆDØÐ!ðØ"(§/¡/�Kؘb  
¨QÐ/Ñ/�DðˆŒ ØˆŒ
؈Œ
؈Œ Ø Ð ÙÔ5Ô7Ü"Ð#YÓZÐZØ#ˆD�Nä+Ó-×4Ñ4ˆDŒN؈Œ Ý !Ø"ˆDŒOØ ˆÔÜ›ˆŒ
Ø ˆÔØ ˆÔä—{‘{ˆŒ Ü"9Ó";ˆÔä�
‰
�dÕøô1&òÙðúsªDÄ DÄDcóÜ—|jj«|rB|j�5|jj«|jj«yyd|_d|_yr#)rrVrrYr)rFÚis_alives r&Ú_reset_internal_lockszThread._reset_internal_locks®s`€ð
�
‰
×%Ñ%Ô'Ù ð× Ñ Ð,Ø×!Ñ!×1Ñ1Ô3Ø×!Ñ!×)Ñ)Õ+ð-ð $ˆDÔ Ø $ˆDÕ r%cóR—|jsJd«‚d}|jj«rd}|j«|jrd}|j
r|dz
}|j �|d|j zz
}d|jj›d|j›d |›d
�S) Nz Thread.__init__() was not calledÚinitialÚstartedÚstoppedz daemonz %sr±ú(z, z)>)
rrrÏr#rrrrNrvr
)rFrÌs r&rTzThread.__repr__¿s’€Ø× Ò ÐDÐ"DÓDÐ ØˆØ �=‰=× Ñ Ô !؈FØ �
‰
ŒØ × Ò ØˆFØ �>Š>Ø �iÑ ˆFØ �;‰;Ð "Ø �e˜dŸk™kÑ)Ñ )ˆFøØ!%§¡×!8Ó!8¸$¿*»*ÂfÐMÐMr%có†—|js td«‚|jj«r td«‚t5|t
|<ddd« t
|jd«|jj«y#1swYŒ;xYw#t$r$t5t
|=ddd«‚#1swY‚xYwwxYw)a-Start 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 onceNr$)
rr`rrÏÚ_active_limbo_lockÚ_limboÚ_start_new_threadÚ
_bootstrapÚ Exceptionr“rEs r&Ústartz Thread.startÍs«€ð× Ò ÜÐ=Ó>Ð >à �=‰=× Ñ Ô !ÜÐAÓBÐ Bä
ñ ØŒF�4‰L÷ ð Ü ˜dŸo™o¨rÔ 2ð
�
‰
×ÑÕ÷ ð ûôò Ü#ñ
!ܘ4�L÷
!à ÷
!à úð ús0Á
BÁBÂBÂCÂ"B3Â* CÂ3B< Â8CcóŒ— |j�&|j|ji|j¤Ž|`|`|`y#|`|`|`wxYw)aXMethod 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 rrrEs r&Úrunz
Thread.runçsI€ð 7Ø�|‰|Ð'Ø�— ‘ ˜dŸj™jÐ9¨D¯L©LÒ9ð� ˜d˜j¨$©,ø�� ˜d˜j¨$©,ús ‚2;»AcóZ— |j«y#|jrt€Yy‚xYwrc)Ú_bootstrap_innerrr/rEs r&r.zThread._bootstrapøs+€ð Ø × !Ñ !Õ #øð Ø�~Š~¤$ ,ÙØ ús ‚“*©*có"—t«|_yrc)rrrEs r&Ú
_set_identzThread._set_ident s €Ü“kˆ� r%có"—t«|_yrc)r(rrEs r&Ú_set_native_idzThread._set_native_ids €Ü+›oˆD�Or%cóø—t«|_|jj«|js9t5t «t j|j«ddd«yy#1swYyxYw)z”
Set a lock object which will be released by the interpreter when
the underlying thread state (see pystate.h) gets deleted.
N)Ú
_set_sentinelrrYrÚ_shutdown_locks_lockrrrrEs r&Ú_set_tstate_lockzThread._set_tstate_locksc€ô
*›OˆÔØ ×Ñ×!Ñ!Ô#à�{Š{Ü%ñ
7Ü(Ô*Ü×#Ñ# D×$5Ñ$5Ô6÷
7ð
7ð÷
7ð
7ús ¼*A0Á0A9có(— |j«|j«tr|j«|jj «t 5|t|j<t|=ddd«trtjt«trtjt« |j«|j#«y#1swYŒixYw#|j!|«YŒ2xYw#|j#«wxYwrc)r6r<rr8rrÊr+rKrr,r4r/rr+rr2rÚ_deleterEs r&r4zThread._bootstrap_inner sÀ€ð Ø �O‰OÔ Ø × !Ñ !Ô #Ý%Ø×#Ñ#Ô%Ø �M‰M× Ñ Ô Ü#ñ
!Ø'+”˜Ÿ ™ Ñ$ܘ4�L÷
!õÜ—
‘
œkÔ*ÝÜ—‘¤
Ô.ð
.Ø—‘”
ð
�L‰L�N÷
!ð
!ûð
.Ø×'Ñ'¨Ö-ûà �L‰L�Nús7‚AC?ÁCÁ3AC?Â:C'ÃC$à C?Ã'C<Ã:C?Ã?DcóÄ—|j}|�|j«rJ‚d|_d|_|jst5t «ddd«yy#1swYyxYwr#)rrIrrr;rrs r&Ú_stopz Thread._stop7sc€ð"× Ñ ˆØ Ð Ø—{‘{”}Ð $Ð$ØˆÔØ ˆÔØ�{Š{Ü%ñ
+ä(Ô*÷
+ð
+ð÷
+ð
+ús Á AÁAcóX—t5tt«=ddd«y#1swYyxYw)zARemove current thread from the dict of currently running threads.N)r+rKrrEs r&r>zThread._deleteRs$€ä
ñ %Üœ › Ð$÷ %÷ %ñ %ús‡  )có—|js td«‚|jj«s td«‚|t «ur td«‚|€|j «y|j t
|d«¬«y)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
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)r[)rr`rrÏr
Ú_wait_for_tstate_lockÚmaxrïs r&Újoinz Thread.join[sv€ð0× Ò ÜÐ=Ó>Ð >Ø�}‰}×#Ñ#Ô%ÜÐHÓIÐ IØ ”>Ó#Ñ #ÜÐ;Ó<Ð <à ˆ?Ø × &Ñ &Õ (ð
× &Ñ &¬s°7¸A«Ð &Õ ?r%có—|j}|€|jsJ‚y |j||«r!|j«|j «yy#|j «r |j«|j «‚xYwrc)rrrYrar@rI)rFÚblockr[r€s r&rDzThread._wait_for_tstate_lock�sw€ð× Ñ ˆØ ˆ<à×#Ò#Ð #Ð#Ø ð Ø�|‰|˜E 7Ô+Ø— ‘ ”Ø—
‘
• ð,øð Ø�{‰{Œ}ð
— ‘ ”Ø—
‘
” Ø ús Ÿ2AÁ3Bcó@—|jsJd«‚|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.
rC)rr
rEs r&rLz Thread.nameœs#€ð× Ò Ð@Ð"@Ó@Ð Ø�z‰zÐr%cóJ—|jsJd«‚t|«|_y)NrC)rr
r
)rFrLs r&rLz Thread.name§s"€à× Ò Ð@Ð"@Ó@Рܘ“Yˆ�
r%có@—|jsJd«‚|jS)a4Thread 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.
rC)rrrEs r&Úidentz Thread.ident¬s#€ð× Ò Ð@Ð"@Ó@Ð Ø�{‰{Ðr%có@—|jsJd«‚|jS)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.