
    /hh-	                     ~    S r SSKrSSKrSSKrSSKrSSKJr  SSKJr  SSK	r	Sr
SrSr " S S	\R                  5      rg)
ar  This test case provides support for checking forking and wait behavior.

To test different wait behavior, override the wait_impl method.

We want fork1() semantics -- only the forking thread survives in the
child after a fork().

On some systems (e.g. Solaris without posix threads) we find that all
active threads survive in the child after a fork(); this is an error.
    N)support)threading_helper   g      ?   c                   2    \ rS rSrS rS rS rS rS rSr	g)	ForkWait   c                 b    [         R                  " 5       U l        0 U l        SU l        / U l        g )Nr   )r   threading_setup_threading_keyalivestopthreads)selfs    7/opt/python-3.13.8/usr/lib/python3.13/test/fork_wait.pysetUpForkWait.setUp   s(    .>>@
	    c                     SU l         U R                   H  nUR                  5         M     S nU R                  R                  5         [        R
                  " U R                  6   g )N   )r   r   joinclearr   threading_cleanupr   )r   threads     r   tearDownForkWait.tearDown   sI    	llFKKM #**D,?,?@r   c                     U R                   (       dQ  [        R                  " 5       U R                  U'    [        R
                  " [        5        U R                   (       d  MP  g g ! [         a     N!f = f)N)r   osgetpidr   timesleep
SHORTSLEEPOSError)r   ids     r   f
ForkWait.f(   sL    ))YY[DJJrN

:& )))  s   A$ $
A10A1c                ,    [         R                  " XS9  g )Nexitcode)r   wait_process)r   cpidr)   s      r   	wait_implForkWait.wait_impl0   s    T5r   c                    [        [        5       HN  n[        R                  " U R                  U4S9nUR                  5         U R                  R                  U5        MP     [        R                  " [        R                  5       H"  n[        U R                  5      [        :  d  M"    O   [        U R                  R                  5       5      nU R                  U[!        [        [        5      5      5        U R                  R#                  5       n[$        R&                  " [(        SS9   [*        R,                  " 5       =nS:X  ab  [.        R0                  " [2        5        SnU R                   H  nU R                  U   XX   :w  d  M  US-  nM!     [*        R4                  " U5        OU R7                  USS9  S S S 5        g ! , (       d  f       g = f)N)targetargsignore)categoryactionr   r   r(   )rangeNUM_THREADS	threadingThreadr%   startr   appendr   sleeping_retrySHORT_TIMEOUTlenr   sortedkeysassertEquallistcopywarningscatch_warningsDeprecationWarningr   forkr    r!   	LONGSLEEP_exitr,   )	r   ir   _aprefork_livesr+   nkeys	            r   	test_waitForkWait.test_wait3   sH   {#A%%TVV1$?FLLNLL' $ ''(=(=>A4::+- ? 4::??$%D{!345

) $$.@,46	!a'

9%::Czz#-*<<Q &  ta06 6 6s   *AG0G
G)r   r   r   r   N)
__name__
__module____qualname____firstlineno__r   r   r%   r,   rN   __static_attributes__ r   r   r   r      s    A61r   r   )__doc__r   r    unittestr6   testr   test.supportr   rB   rF   r"   r5   TestCaser   rU   r   r   <module>r[      sA   	     )  	
91x   91r   