+
    BiL"                         ^ RI t ^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RIHt R t	R t
R t]P                  RR l4       tRR lt]P                  RR l4       t ! R	 R
4      tR R lt]! 4       tRR/R ltR/ 3R ltR# )    N)supportc                  ^    \         P                  ! 4       \        \        P                  4      3# N)_thread_countlen	threading	_dangling     4/usr/lib/python3.14/test/support/threading_helper.pythreading_setupr      s    >>S!4!4555r   c                  x   V w  rR p\         P                  ! VRR7       F:  p\        \        P                  4      p\
        P                  ! 4       pWa8:  g   K9   R# 	  R\         n        \         P                  ! RVR RV RV R	X R\        X4       2
4       V F  p\         P                  ! R
V: 24       K  	  R# )g      ?FerrorNTz2threading_cleanup() failed to clean up threads in .1fz  seconds
  before: thread count=z, dangling=z
  after: thread count=zDangling thread: )
r   sleeping_retrylistr	   r
   r   r   environment_alteredprint_warningr   )original_values
orig_countorig_ndanglingtimeout_dangling_threadscountthreads   *       r   threading_cleanupr      s    !0JG##G59  	 3 34  : #'Gc] "",[8H I!!&{37G3H2I	KL
 # 1&<= #r   c                 F   a  \         P                  ! S 4      V 3R  l4       pV# )c                  T   < \        4       p S! V !  \        V!   #   \        T!   i ; ir   )r   r   )argskeyfuncs   * r   	decoratorreap_threads.<locals>.decorator>   s)    	$;s#s#s    ')	functoolswraps)r$   r%   s   f r   reap_threadsr)   :   s(     __T$ $ r   c              #      "   V f   \         P                  p \        P                  ! 4       p R x  \        P
                  ! 4       p\         P                  ! V RR7       F6  p\         P                  ! 4        \        P                  ! 4       pWA8:  g   K5   R # 	  \        P
                  ! 4       V,
          pRXV,
           RVR RV RV R2	p\        V4      h  \        P
                  ! 4       p\         P                  ! T RR7       F5  p\         P                  ! 4        \        P                  ! 4       pYA8:  g   K5   i 	  \        P
                  ! 4       T,
          pRXT,
           RTR RT RT R2	p\        T4      h; i5i)	NFr   z!wait_threads() failed to cleanup z threads after r   z seconds (count: z, old count: ))	r   SHORT_TIMEOUTr   r   time	monotonicr   
gc_collectAssertionError)r   	old_count
start_timer   r   dtmsgs   &      r   wait_threads_exitr5   H   s\     '' I&^^%
''u=A NN$E!	 > !J.B6uy7H6I J$$&s8 ,#WM)A?C !%% ^^%
''u=A NN$E!	 > !J.B6uy7H6I J$$&s8 ,#WM)A?C !%%s+   *E>C AE>AE>AE;9AE;;E>c                     Vf   \         P                  pV P                  V4       V P                  4       '       d   RVR R2p\	        V4      hR # )Nzfailed to join the thread in r   z seconds)r   r,   joinis_aliver0   )r   r   r4   s   && r   join_threadr9   k   sM     ''
KK-gc](CS!! r   c              #     "    ^ RI p\        V 4      p . p  V  F$  pVP                  4        VP	                  V4       K&  	  Rx   T'       d   T! 4        \        P                  ! 4       p\        ^^4       F  pT^<,          pT F8  pTP                  \        T\        P                  ! 4       ,
          R4      4       K:  	  T Uu. uF  qDP                  4       '       g   K  TNK  	  ppT'       g    M9\
        P                  '       g   K  \        R\        T4      T3,          4       K  	  T Uu. uF  qDP                  4       '       g   K  TNK  	  ppT'       d?   Te    TP                  \         P"                  4       \%        R\        T4      ,          4      hR#   \         d    Rp ELi ; i   \
        P                  '       d'   \        R\        T 4      \        T4      3,          4       h ; iu upi u upi   T Uu. uF  qDP                  4       '       g   K  TNK  	  Mu upi ppT'       d?   Te    TP                  \         P"                  4       \%        R\        T4      ,          4      hi ; i   T'       d   T! 4        \        P                  ! 4       p\        ^^4       F  pT^<,          pT F8  pTP                  \        T\        P                  ! 4       ,
          R4      4       K:  	  T Uu. uF  qDP                  4       '       g   K  TNK  	  Mu upi ppT'       g    M9\
        P                  '       g   K  \        R\        T4      T3,          4       K  	  T Uu. uF  qDP                  4       '       g   K  TNK  	  Mu upi ppT'       d?   Te    TP                  \         P"                  4       \%        R\        T4      ,          4      hi   T Uu. uF  qDP                  4       '       g   K  TNK  	  Mu upi ppT'       d?   Te    TP                  \         P"                  4       \%        R\        T4      ,          4      hi ; i; i5i)r   Nz/Can't start %d threads, only %d threads startedg{Gz?z7Unable to join %d threads during a period of %d minuteszUnable to join %d threads)faulthandlerImportErrorr   startappendr   verboseprintr   r-   r.   ranger7   maxr8   dump_tracebacksysstdoutr0   )threadsunlockr;   startedtendtimer   s   &&     r   start_threadsrK   w   sD     7mGGQ		q!  		Qnn&G B<2 AFF3w)994@A !&->g11g>??? '*-g,)@A B ( #*:'QZZ\qq'G:+ //

;$%@3w<%OPP C  	G7|S\23 4 ? ;':'QZZ\qq':G:+ //

;$%@3w<%OPP !	Qnn&G B<2 AFF3w)994@A !&->g11g>>??? '*-g,)@A B ( #*:'QZZ\qq':G:+ //

;$%@3w<%OPP  #*:'QZZ\qq':G:+ //

;$%@3w<%OPP s  QF Q*F/ I4 A>G; G1 G1&G; 
!G; +Q/G6G6A
QF,(Q+F,,Q/?G..I4 1G; 6Q;I1 H#H#"AI11Q4Q6A>O4L
L
%O !O!Q%NNAQQO>7O>=AQQQc                   8   a  ] tR t^t o R tR tR tR tRtV t	R# )catch_threading_exceptionc                L    R V n         R V n        R V n        R V n        R V n        R # r   )exc_type	exc_valueexc_tracebackr   	_old_hookselfs   &r   __init__"catch_threading_exception.__init__   s&    !r   c                    VP                   V n         VP                  V n        VP                  V n        VP                  V n        R # r   )rO   rP   rQ   r   )rT   r"   s   &&r   _hookcatch_threading_exception._hook   s1    !//kkr   c                Z    \         P                  V n        V P                  \         n        V # r   )r	   
excepthookrR   rX   rS   s   &r   	__enter__#catch_threading_exception.__enter__   s     "--#zz	r   c                @    V P                   \        n        V =V =V =V =R # r   )rR   r	   r[   rO   rP   rQ   r   )rT   exc_infos   &*r   __exit__"catch_threading_exception.__exit__   s#    #~~	MNKr   )rR   rQ   rO   rP   r   N)
__name__
__module____qualname____firstlineno__rU   rX   r\   r`   __static_attributes____classdictcell__)__classdict__s   @r   rM   rM      s     >"
 r   rM   c                $    V ^8  d   QhR\         /# )   return)bool)formats   "r   __annotate__rn      s      4 r   c                      \         P                  R 8X  d   \         P                  P                  # \         P                  R8X  d   R# R# )
emscriptenwasiFT)rD   platform_emscripten_infopthreadsr   r   r   _can_start_threadru      s6     |||###,,,		 r   moduleFc                     R pV '       d%   \         '       g   \        P                  ! V4      hR# \        P                  ! \         V4      # )zrequires threading supportN)can_start_threadunittestSkipTest
skipUnless)rv   r4   s   $ r   requires_working_threadingr|      s>    
 'C##C((   ""#3S99r   c                   a a \         P                  ! V4      oVV 3R  lp\        4       ;_uu_ 4       p\        V4       Uu. uF  p\         P                  ! WBVR7      NK  	  pp\        V4      ;_uu_ 4         RRR4       VP                  e   VP                  h RRR4       R# u upi   + '       g   i     L:; i  + '       g   i     R# ; i)c                  8   < SP                  4        S! V / VB  R # r   )wait)r"   kwargsbarrierworker_funcs   *,r   wrapper_func&run_concurrently.<locals>.wrapper_func  s    T$V$r   )targetr"   r   N)r	   BarrierrM   rA   ThreadrK   rP   )	r   nthreadsr"   r   r   cmr   workersr   s	   f&&&    @r   run_concurrentlyr      s     )G%
 
#	$	$ 8_
$ LFK$ 	 
 7## $ <<#,, $ 
%	$
 $# 
%	$	$s5   B= !B%!B=6B*	8"B=%B=*B:5B==C	r   r   )r   
contextlibr'   rD   r	   r-   ry   testr   r   r   r)   contextmanagerr5   r9   rK   rM   ru   rx   r|   r   r   r   r   <module>r      s       
    6>< & &D	" 'Q 'QT6 6r& %& 
: 
: 24B r   