import threading
class MyThread(threading.Thread):
def __init__(self):
threading.Thread.__init__(self)
self.stopthread = threading.Event()
def run(self):
while not self.stopthread.isSet():
for f in xrange(0,500):
print "Hello from the thread"
def stop(self):
self.stopthread.set()
mythread = MyThread()
mythread.start()
for f in xrange(0,4):
print "hello from the outside"
#--------------------------------------------------
# //mythread.stop()
#--------------------------------------------------