Skip to content

Instantly share code, notes, and snippets.

@hktechn0
Created March 8, 2010 18:19
Show Gist options
  • Save hktechn0/325419 to your computer and use it in GitHub Desktop.
Save hktechn0/325419 to your computer and use it in GitHub Desktop.
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