python (3.12.0)

(root)/
lib/
python3.12/
test/
__pycache__/
test_thread.cpython-312.pyc

Αew#ddlZddlZddlZddlmZddlmZddlZddl	Z	ddl
Z
ddlZddlmZejddZdZej Zd	ZGd
dej&ZGdd
eZGddZGddeZGddej0ZGddej&Zedk(rej6yy)N)support)threading_helper)
lock_testsT)module
crtjrt5t|dddyy#1swYyxYw)z2Helper function for printing out debugging output.N)rverbose_print_mutexprint)args D/BuggyBox/python/3.12.0/bootstrap/lib/python3.12/test/test_thread.py
verbose_printrs2
	#J				s-6ceZdZdZy)BasicThreadTestcbtj|_|jjtj|_tj|_d|_d|_d|_tj}|jtjg|yNr)
thread
allocate_lock
done_mutexacquire
running_mutexrandom_mutexcreatedrunning
next_identrthreading_setup
addCleanupthreading_cleanup)selfkeys  rsetUpzBasicThreadTest.setUps ..0!#113"002..0(::ASAN)__name__
__module____qualname__r"r#rrrs
Br#rczeZdZdZdZdZdZeje	jdvddZdZd	Z
y
)ThreadRunningTestscJ|j5|xjdz
c_td|jztj|j
|jf|xjdz
c_|xjdz
c_dddy#1swYyxYw)Nzcreating task %s)rrrrstart_new_threadtaskrrr s rnewtaskzThreadRunningTests.newtask,sw


	OOq O,t>?##DII/ABLLALLLAL			sBBB"c	|j5tjdz}dddtd|dtdzdt	j
|td|z|j5|xjdzc_|jtk(r)|jdk(r|jjdddy#1swYxYw#1swYyxYw)	N@task  will run for .Ausztask %s doner+r)rrandomrroundtimesleeprrrNUMTASKSrrelease)r identdelays   rr-zThreadRunningTests.task4s


	.MMOg-E	.UE%)<LMN

5nu,-


	*LLAL||x'DLLA,='')	*	*	.	.
	*	*sC:AC!C!C*ctj5ttD]}|j	td|jjtddddy#1swYyxYw)Nz waiting for tasks to complete...all tasks done)rwait_threads_exitranger:r/rrrr is  rtest_starting_threadsz(ThreadRunningTests.test_starting_threads?sa

/
/
1	,8_

<=OO##%*+
	,	,	,sAA33A<c|jtjddtjd|jtjddy)Nrzinitial stack size is not 0zstack_size not reset to default)assertEqualr
stack_sizer.s rtest_stack_sizez"ThreadRunningTests.test_stack_sizeHsH**,a1NO!**,a1RSr#)ntposixztest meant for nt and posixc	tjdd}dD]M}tj||j
tj|||ztd|zOdD]}td|zd	|_d	|_tj5ttD]}|jtd
|jjtddddtjd	y#t$rtdYtj$r|jdY;wxYw#1swYxYw)Niz3caught expected ValueError setting stack_size(4096)z4platform does not support changing thread stack sizez&stack_size(%d) failed - should succeed)rzsuccessfully set stack_size(%d))rLrMztrying stack_size = (%d)rz!waiting for all tasks to completer?)rrG
ValueErrorrerrorskipTestrFrrrr@rAr:r/rr)r fail_msgtssrCs    rtest_nt_and_posix_stack_sizez/ThreadRunningTests.test_nt_and_posix_stack_sizeOsF	"d#<(	CCc"V..0#x#~F;cAB	C
&
	0C4s:;DODL!335
0x#ALLN#AB'')./

0
0	
	0	!3	0/
0||	"MM!
"	"
0
0s$D AEE,#EEE	ctj}tjjgfd}t	j
5tj|dtjtjD]}sn|jtj|dzjgtj|fd}~tjtjD]}rntj|jtj|dddy#1swYyxYw)NchjdjjyN)appendrr;)mutstartedsrr-z,ThreadRunningTests.test__count.<locals>.taskus!NN4 KKMKKMr#r'r+c&jdSrV)rW)_dones r<lambda>z0ThreadRunningTests.test__count.<locals>.<lambda>sT[[->r#)r_countrrrr@r,rsleeping_retryLONG_TIMEOUTrFr;weakrefref
gc_collect)r origr-r[wrr\rXrYs     @@@rtest__countzThreadRunningTests.test__countns}}""$
	

/
/
1	4##D"-++G,@,@A


V]]_dQh7
KKM
DT#>?B++G,@,@A
%""$
%
V]]_d3+	4	4	4s?EB:EE$cfd}tjtj5}t	j
5j
tj|dj
ddd|jt|jjd|j|jj||j|jjd|j|jj dddy#1swYxYw#1swYyxYw)Nc:jtd)Ntask failed)r;rN)rYsrr-z:ThreadRunningTests.test_unraisable_exception.<locals>.tasksOO]++r#r'riz&Exception ignored in thread started by)rrrcatch_unraisable_exceptionrr@rr,rFstr
unraisable	exc_valueassertIsobjecterr_msgassertIsNotNone
exc_traceback)r r-cmrYs   @rtest_unraisable_exceptionz,ThreadRunningTests.test_unraisable_exceptions	,&&(

/
/
1
	>R!335
"!''b1!
"

S!8!89=IMM"--..5R]]22E
G  !<!<=
	>
	>
"
"
	>
	>s$D87D,;B(D8,D5	1D88EN)r$r%r&r/r-rDrHunittestskipIfosnamerSrfrtr'r#rr)r)*sN	*,TX__RWWO35RST<!4F>r#r)ceZdZdZdZy)Barrierc||_d|_tj|_tj|_|j
j
yr)num_threadswaitingrr
checkin_mutexcheckout_mutexr)r r|s  r__init__zBarrier.__init__sE&$224$224##%r#c|jj|jdz|_|j|jk(r/|jdz
|_|jjy|jj|jj|jdz
|_|jdk(r|jjy|jjy)Nr+r)r~rr}r|rr;r.s renterz
Barrier.enters""$||a'<<4+++++a/DL'')""$##%||a'<<1&&(##%r#N)r$r%r&rrr'r#rrzrzs&&r#rzceZdZdZdZy)BarrierTestc^tj5tt|_t|_t
tD]#}tj|j|f%td|jjtddddy#1swYyxYw)Nzwaiting for tasks to endz
tasks done)
rr@rzr:barrrArr,task2rrrrBs  rtest_barrierzBarrierTest.test_barriers

/
/
1	(x(DH#DL8_
:''

QD9
:45OO##%,'	(	(	(sBB##B,c
HttD]}|dk(rd}n,|j5tjdz}dddt	d|dtdzdt
j|t	d|d||jjt	d|z|j5|xjd	zc_|jdk(}dddr|jjyy#1swYxYw#1swY3xYw)
Nrr1r2r3r4r5z
 entering ztask %s leaving barrierr+)rANUMTRIPSrr6rr7r8r9rrrrrr;)r r<rCr=finisheds     rrzBarrierTest.task2sx	=Az&&6"MMOg5E6 %"46
7JJu5!<=HHNN3e;<	=

	)LLAL||q(H	)OO##%66	)	)sD%DD	D!N)r$r%r&rrr'r#rrrs(&r#rc$eZdZejZy)	LockTestsN)r$r%r&rrlocktyper'r#rrrs
##Hr#rcdeZdZdZej
ejdZdZ	y)TestForkInThreadcFtj\|_|_yrV)rwpiperead_fdwrite_fdr.s rr"zTestForkInThread.setUps&(ggi#dmr#cdfd}tj5tj||j|j
f|j
tj|jddtj|j
ddd|jtjdy#1swY2xYw)Nc^tjtd5tjxr
	dddy	ddd	tj
|tj|dtjdy#1swYKxYw#tjdwxYw)Nignore)categoryactionOKr)warningscatch_warningsDeprecationWarningrwforkclosewrite_exit)rrpids  rfork_threadz7TestForkInThread.test_forkinthread.<locals>.fork_threads((2D08:
779$C$

%

!5)

sB	+B	BB,rr)exitcode)
rr@rr,rrrFrwreadrrqrwait_process)r rrs  @rtest_forkinthreadz"TestForkInThread.test_forkinthreads	$
/
/
1	$##K$,,

1NORWWT\\15u=HHT]]#	$
	
S!S1-
	$	$sA<C

Cc	tj|j	tj|jy#t$rY,wxYw#t$rYywxYwrV)rwrrOSErrorrr.s rtearDownzTestForkInThread.tearDown	sS	HHT\\"	HHT]]#			
		s"AA	A
A	AAN)
r$r%r&r"r
requires_forkrreap_threadsrrr'r#rrrs90W"".#.:	r#r__main__)rwrur6testrtest.supportr_threadrr8rrarrequires_working_threadingr:rrrrTestCaserr)rzrrrr$mainr'r#r<module>rs	
)+++48
#v##%Bh''Bw>w>t&&2#&/#&J$
$$$,x((,^zHMMOr#