Path: csiph.com!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: Paul Rubin Newsgroups: comp.lang.python Subject: Re: asyncio - run coroutine in the background Date: Wed, 17 Feb 2016 20:38:14 -0800 Organization: A noiseless patient Spider Lines: 8 Message-ID: <87vb5m7hvt.fsf@jester.gateway.pace.com> References: <8737sumpjl.fsf@elektro.pacujo.net> <87h9ha8lt0.fsf@jester.gateway.pace.com> <87d1rwpwo2.fsf@elektro.pacujo.net> <56c33d7e$0$1587$c3e8da3$5496439d@news.astraweb.com> <87vb5ok2ab.fsf@elektro.pacujo.net> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: mx02.eternal-september.org; posting-host="560a36ee31cc4bcf69e115b311f0cc5c"; logging-data="21362"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/0d1k2rT8yMHaUo22qwYwp" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) Cancel-Lock: sha1:zmRRoLWtKMDwQD1wlNOYcm2iZiQ= sha1:fZHqEzy0VO0zKbFl99ma6yGDcBU= Xref: csiph.com comp.lang.python:103082 Marko Rauhamaa writes: > @asyncio.coroutine > def background_task(): ... > while time.time() - t < 10: > pass Wait, that's a cpu-busy loop, you can't do that in cooperative multitasking. Of course you need a wait there.