scheduler.py

changeset 8
7b2d2eac6a48
parent 7
e189d4a6cb8c
child 9
aa121291eb0e
equal deleted inserted replaced
7:e189d4a6cb8c 8:7b2d2eac6a48
1 #
2 # Borgend scheduler
3 #
4
5 from Queue import Queue
6 import sched
7 import ui
8
9
10 class Scheduler:
11
12 def __init__(self, backups):
13 self.backups=backups
14 self.eventqueue=Queue()
15 self.t=Thread(target=self.__scheduler)
16 t.start()
17
18 def __scheduler(sched):
19 timeout=???
20 q=sched.eventqueue
21 while True:
22 timeout, timerevent=next_timed_event(sched);
23 t=Timer(timeout, lambda: q.put(timerevent));
24 event=sq.get(True):
25 # Decide what to do

mercurial