Current File : //opt/imh-python/lib/python2.7/test/test_thread.pyc
�
��Wc@sEddlZddlZddlZddlmZejd�ZddlZddlZddl	Z	ddlm
Z
dZdZej
�Zd�Zdejfd	��YZd
efd��YZddd
��YZdefd��YZde
jfd��YZdejfd��YZd�ZedkrAe�ndS(i����N(ttest_supporttthread(t
lock_testsi
icCs"tjrt�
|GHWdQXndS(s2Helper function for printing out debugging output.N(Rtverboset_print_mutex(targ((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_thread.pyt
verbose_prints	tBasicThreadTestcBseZd�ZRS(cCsYtj�|_|jj�tj�|_tj�|_d|_d|_d|_dS(Ni(	Rt
allocate_lockt
done_mutextacquiret
running_mutextrandom_mutextcreatedtrunningt
next_ident(tself((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_thread.pytsetUps
		(t__name__t
__module__R(((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_thread.pyRstThreadRunningTestscBsbeZd�Zd�Zd�Zd�Zejej	dkd�d��Z
d	�Zd
�ZRS(cCsk|j�\|jd7_td|j�tj|j|jf�|jd7_|jd7_WdQXdS(Niscreating task %s(RRRRtstart_new_threadttaskR
R(R((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_thread.pytnewtask's
cCs�|j�tj�d}WdQXtd|t|d�f�tj|�td|�|j�B|jd8_|jt	kr�|jdkr�|j
j�nWdQXdS(Ng��@stask %s will run for %susg��.Astask %s doneii(RtrandomRtroundttimetsleepRRR
tNUMTASKSR	trelease(Rtidenttdelay((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_thread.pyR/s


cCsFxtt�D]}|j�q
Wtd�|jj�td�dS(Ns waiting for tasks to complete...sall tasks done(trangeRRRR	R
(Rti((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_thread.pyttest_starting_threads:s


cCsC|jtj�dd�tjd�|jtj�dd�dS(Nisinitial stack size is not 0sstack_size not reset to default(tassertEqualRt
stack_size(R((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_thread.pyttest_stack_sizeBs
tnttos2tposixs!test meant for nt, os2, and posixcCs"ytjd�Wn;tk
r.td�n!tjk
rN|jd�nXd}xFdD]>}tj|�|jtj�|||�td|�q\Wxpd
D]h}td	|�d|_d|_xt	t
�D]}|j�q�Wtd
�|jj
�td�q�Wtjd�dS(Nis3caught expected ValueError setting stack_size(4096)s4platform does not support changing thread stack sizes&stack_size(%d) failed - should succeediiissuccessfully set stack_size(%d)strying stack_size = (%d)s!waiting for all tasks to completesall tasks done(iii(ii(RR$t
ValueErrorRterrortskipTestR#RR
R RRR	R
(Rtfail_msgttssR!((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_thread.pyttest_nt_and_posix_stack_sizeIs*




		

cs�tj�}tj���j�g���fd�}tj|d�x�sctjd�qMW|jtj�|d��j�g�t	j
|�fd��}~x�s�tjd�q�W|jtj�|�dS(Ncs%�jd��j��j�dS(N(tappendtNoneR
R((tmuttstarted(si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_thread.pyRms

g{�G�z�?ics
�jd�S(N(R/R0(t_(tdone(si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_thread.pyt<lambda>{s((Rt_countRR
RRRR#Rtweakreftref(RtorigRtwr((R4R1R2si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_thread.pyttest__countgs 
	
	cs��fd�}�fd�}tj�}tj��tjd��c}|j�||_�j�tj|d��j�x#tj�|kr�tj	d�q�WWdQX|j
d|j��dS(Ncs�j�t�dS(N(RtSyntaxError((R2(si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_thread.pyR�s
cs/y
t�Wntk
rnX�||�dS(N(R)(Rtargs(t
real_write(si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_thread.pytmywrite�s


tstderrg{�G�z�?t	Traceback((RR6RRtcaptured_outputtwriteR
RRRtassertIntgetvalue(RRR?tcR@((R>R2si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_thread.pyt"test_save_exception_state_on_error�s		

(sntsos2sposix(
RRRRR"R%tunittesttskipIftostnameR.R;RG(((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_thread.pyR%s				$	tBarriercBseZd�Zd�ZRS(cCsA||_d|_tj�|_tj�|_|jj�dS(Ni(tnum_threadstwaitingRRt
checkin_mutextcheckout_mutexR
(RRM((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_thread.pyt__init__�s
		cCs�|jj�|jd|_|j|jkrP|jd|_|jj�dS|jj�|jj�|jd|_|jdkr�|jj�dS|jj�dS(Nii(ROR
RNRMRPR(R((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_thread.pytenter�s




(RRRQRR(((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_thread.pyRL�s	tBarrierTestcBseZd�Zd�ZRS(cCsjtt�|_t|_x*tt�D]}tj|j|f�q%Wtd�|j	j
�td�dS(Nswaiting for tasks to ends
tasks done(RLRtbarRR RRttask2RR	R
(RR!((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_thread.pyttest_barrier�s	

cCs�x�tt�D]�}|dkr(d}n |j�tj�d}WdQXtd|t|d�f�tj|�td||f�|jj	�td|�q
W|j
�#|jd8_|jdk}WdQX|r�|jj
�ndS(Nig��@stask %s will run for %susg��.Astask %s entering %sstask %s leaving barrieri(R tNUMTRIPSRRRRRRRTRRRRR	R(RRR!Rtfinished((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_thread.pyRU�s 	



(RRRVRU(((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_thread.pyRS�s		t	LockTestscBseZejZRS((RRRRtlocktype(((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_thread.pyRY�stTestForkInThreadcBsJeZd�Zejejjd�d�ej	d���Z
d�ZRS(cCstj�\|_|_dS(N(RJtpipetread_fdtwrite_fd(R((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_thread.pyR�stwins5This test is only appropriate for POSIX-like systems.csE�fd�}tj|d��jtj�jd�dd�dS(Ncs�ytj�}Wntk
r0tjd�nX|dkrptj�j�tj�jd�tj	d�ntj�j�dS(NitOK(
RJtforktRuntimeErrortsystexittcloseR]RCR^t_exit(tpid(R(si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_thread.pytthread1�s
iR`sUnable to fork() in thread((RRR#RJtreadR](RRh((Rsi/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_thread.pyttest_forkinthread�scCsTytj|j�Wntk
r'nXytj|j�Wntk
rOnXdS(N(RJReR]tOSErrorR^(R((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_thread.pyttearDown�s

(RRRRHRIRctplatformt
startswithRtreap_threadsRjRl(((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_thread.pyR[�s
	cCstjtttt�dS(N(Rtrun_unittestRRSRYR[(((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_thread.pyt	test_mainst__main__((RJRHRttestRt
import_moduleRRRcR7RRRWRRRtTestCaseRRRLRSRYR[RqR(((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_thread.pyt<module>s*	t%*