Created
March 8, 2010 18:19
-
-
Save hktechn0/325419 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 sched | |
import threading | |
import time | |
class test(threading.Thread): | |
def __init__(self): | |
threading.Thread.__init__(self) | |
self.setDaemon(True) | |
def run(self): | |
while True: | |
time.sleep(5) | |
l.append(None) | |
print l | |
def mysleep(sleep): | |
time.sleep(1) | |
l = list() | |
def len_list(): return int(len(l)) | |
def print_len(): print len(l) | |
s = sched.scheduler(len_list, mysleep) | |
t = test() | |
t.start() | |
print "OK." | |
s.enter(3, 1, print_len, ()) | |
s.run() | |
print "Exit." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment