forked from M-Labs/artiq
1
0
Fork 0

management/scheduler: improve periodic timing precision

This commit is contained in:
Sebastien Bourdeauducq 2014-12-11 15:57:41 +08:00
parent d315268ddb
commit 6ca39f7415
1 changed files with 2 additions and 2 deletions

View File

@ -98,8 +98,8 @@ class Scheduler:
@asyncio.coroutine @asyncio.coroutine
def _schedule(self): def _schedule(self):
next_periodic = yield from self._run_periodic()
while True: while True:
next_periodic = yield from self._run_periodic()
ev_queue = asyncio.Task(self.queue_count.acquire()) ev_queue = asyncio.Task(self.queue_count.acquire())
ev_periodic = asyncio.Task(self.periodic_modified.wait()) ev_periodic = asyncio.Task(self.periodic_modified.wait())
done, pend = yield from asyncio.wait( done, pend = yield from asyncio.wait(
@ -109,7 +109,7 @@ class Scheduler:
for t in pend: for t in pend:
t.cancel() t.cancel()
next_periodic = yield from self._run_periodic() yield from self._run_periodic()
if ev_queue in done: if ev_queue in done:
rid, run_params, timeout = self.queued.pop(0) rid, run_params, timeout = self.queued.pop(0)
result = yield from self._run(rid, run_params, timeout) result = yield from self._run(rid, run_params, timeout)