On Tue, 24 Dec 2013 01:12:57 +0100
Tobias Oberstein
<[email protected]> wrote:
> 
> So you say I call the user-level functions (which may be coroutines) 
> like this from within my protocol implementation?
> 
> res = self.onMessage(message)
> if PY3 and (isinstance(res, asyncio.futures.Future) or
>              inspect.isgenerator(res)):
>     asyncio.async(res)
> 
> => onMessage is the user code

Yes. Of course, ideally there should be a terser way of saying
"(isinstance(res, asyncio.futures.Future) or inspect.isgenerator(res))"
:-)

> Also: will asyncio.async schedule via reentering the event loop or how? 

Off the top of my head, no. But better confirm by reading the source
code :-)

Regards

Antoine.


Reply via email to