From 114b305203e0a842929a8bf6bcd3fcc238e050c8 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Sun, 22 May 2016 16:36:29 -0700 Subject: [PATCH] use recommended asyncio.ensure_future instead of asyncio.Task --- artiq/devices/ctlmgr.py | 4 ++-- artiq/protocols/sync_struct.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/artiq/devices/ctlmgr.py b/artiq/devices/ctlmgr.py index c9b320602..12b3c46d8 100644 --- a/artiq/devices/ctlmgr.py +++ b/artiq/devices/ctlmgr.py @@ -30,7 +30,7 @@ class Controller: self.retry_timer_cur = self.retry_timer self.retry_now = Condition() self.process = None - self.launch_task = asyncio.Task(self.launcher()) + self.launch_task = asyncio.ensure_future(self.launcher()) async def end(self): self.launch_task.cancel() @@ -160,7 +160,7 @@ class Controllers: self.active_or_queued = set() self.queue = asyncio.Queue() self.active = dict() - self.process_task = asyncio.Task(self._process()) + self.process_task = asyncio.ensure_future(self._process()) async def _process(self): while True: diff --git a/artiq/protocols/sync_struct.py b/artiq/protocols/sync_struct.py index 3d64450da..ce6479e7b 100644 --- a/artiq/protocols/sync_struct.py +++ b/artiq/protocols/sync_struct.py @@ -69,7 +69,7 @@ class Subscriber: before_receive_cb() self.writer.write(_init_string) self.writer.write((self.notifier_name + "\n").encode()) - self.receive_task = asyncio.Task(self._receive_cr()) + self.receive_task = asyncio.ensure_future(self._receive_cr()) except: self.writer.close() del self.reader