Skip to content

Instantly share code, notes, and snippets.

@thequbit
Created December 19, 2013 16:03
Show Gist options
  • Save thequbit/8041652 to your computer and use it in GitHub Desktop.
Save thequbit/8041652 to your computer and use it in GitHub Desktop.
import threading
#from myfuncs import myfunc
class MyThread(threading.Thread):
def __init__(self,name="mythread"):
threading.Thread.__init__(self)
self.name = name
self.done = False
def run(self):
print "I'm running!"
result = self._dowork()
print "I'm done!"
def _dowork(self):
print "I'm working reaaaally hard"
for i in range(0,128):
self.myfunc(i)
def myfunc(self,i):
print "[%i] hi." %i
def main():
print "Starting!"
myThread = MyThread()
myThread.run()
print "All Done Here."
main()
@thequbit
Copy link
Author

need to call myThread.start() not myThread.run().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment