#!/usr/bin/python import threading import time class Client(object): def test_thread(self): print "starting thread" self.thread = threading.Thread(target=self.run) self.thread.start() print "sleeping for 6 seconds" time.sleep(6) print "woken up" self.thread.join() def run(self): for i in range(5): print i time.sleep(1) c = Client() c.test_thread()Source URL:http://www.gossamer-threads.com/lists/python/python/781285
Python threading from a class
Here is threading from a class written for Python v2.6
0 comments:
Post a Comment