A couple of questions on this, but I believe I'm already following their solutions. In the following example, can anyone say why the thread doesn't find that boolean
is updated to True? I've defined it globally..
import threading
import time
boolean = False
class ThreadClass(threading.Thread):
def __init__(self):
global boolean
super(ThreadClass, self).__init__()
def run(self):
global boolean
for i in range(6):
print str(i)
time.sleep(1)
t = ThreadClass().start()
time.sleep(3)
boolean = True
print 'end script'
0
1
2
end script
3
4
5