Message3920
This naive program creates 10000 threads. More than 2000 of them are not
executed completely:
-----
import thread, time
cnt_a = cnt_b = 0
def test():
global cnt_a, cnt_b
time.sleep(1)
cnt_a += 1
time.sleep(1)
cnt_b += 1
i = 10000
while i:
i -= 1
thread.start_new_thread(test, ())
time.sleep(100)
print cnt_a, cnt_b
----
The program prints two different numbers not equal to 10000.
Tested on Linux, Jython2.1, java1.5.0 and Windows, Jython2.5a3, jdk1.6.0_01. |
|
Date |
User |
Action |
Args |
2008-12-15 13:30:13 | gunter.bach | set | recipients:
+ gunter.bach |
2008-12-15 13:30:13 | gunter.bach | set | messageid: <1229347813.14.0.000473318889901.issue1203@psf.upfronthosting.co.za> |
2008-12-15 13:30:13 | gunter.bach | link | issue1203 messages |
2008-12-15 13:30:12 | gunter.bach | create | |
|