I tested this program with saving as ttst.py and running it via
and it ends with 30 as largest print number.
So that it keeps running within idle should be considered a "bug" of IDLE :)
# A simpe program to test compilation of threads
kbh = threading.Lock()
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.
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
your programm wil run for roughly 60 seconds.
So, what I am trying to say: no mainthread, programm ends.
GHUM Harald Massa
persuadere et programmare
Harald Armin Massa
PostgreSQL - supported by a community that does not put you on hold