[Python-checkins] CVS: python/dist/src/Lib/test test_fork1.py,1.2,1.3

Guido van Rossum python-dev@python.org
2000年4月24日 10:07:06 -0400 (EDT)


Update of /projects/cvsroot/python/dist/src/Lib/test
In directory eric:/projects/python/develop/guido/src/Lib/test
Modified Files:
	test_fork1.py 
Log Message:
Added a provision to stop all threads before exiting from the test:
the change to regrtest.py to unload all newly imported modules did
something bad to the threads -- and I realized that they would never
stop!
Index: test_fork1.py
===================================================================
RCS file: /projects/cvsroot/python/dist/src/Lib/test/test_fork1.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** test_fork1.py	2000年04月10日 15:36:39	1.2
--- test_fork1.py	2000年04月24日 14:07:03	1.3
***************
*** 19,24 ****
 alive = {}
 
 def f(id):
! while 1:
 alive[id] = os.getpid()
 try:
--- 19,26 ----
 alive = {}
 
+ stop = 0
+ 
 def f(id):
! while not stop:
 alive[id] = os.getpid()
 try:
***************
*** 54,57 ****
--- 56,63 ----
 assert spid == cpid
 assert status == 0, "cause = %d, exit = %d" % (status&0xff, status>>8)
+ global stop
+ # Tell threads to die
+ stop = 1
+ time.sleep(2*SHORTSLEEP) # Wait for threads to die
 
 main()

AltStyle によって変換されたページ (->オリジナル) /