All pastes #158264 Raw Edit

Miscellany

public text v1 · immutable
·published 2006-09-02 01:35 UTC
rendered paste body
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()
#--------------------------------------------------