Created
December 19, 2013 16:03
-
-
Save thequbit/8041652 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
need to call myThread.start() not myThread.run().