Rod,

I tested this program with saving as ttst.py and running it via

python ttst.py

and it ends with 30 as largest print number.

So that it keeps running within idle should be considered a "bug" of IDLE :)

In addition:
# A simpe program to test compilation of threads

class TTest( threading.Thread):
    kbh = threading.Lock()
    threadid=0

I guess you do not want to do this. With defining "threadid" on this level it is a class-attribute, that ist: thread1 and thread2 do share it.

if __name__=="__main__":
    thread1=TTest(1)
    thread1.start ()
    thread2=TTest(2)
    thread2.start()

threading is a beast :) But as much as I understand: after finishing "thread2.start()", the program is over. You have no sustainable main thread.

if you add something like

import time
time.sleep(60)

your programm wil run for roughly 60 seconds.

So, what I am trying to say: no mainthread, programm ends.

Harald


--
GHUM Harald Massa
persuadere et programmare
Harald Armin Massa
Reinsburgstra├če 202b
70197 Stuttgart
0173/9409607
-
PostgreSQL - supported by a community that does not put you on hold