Your question is a frequent question. We should enhance the documentation
to explain how to use coroutines in protocols, signal handlers and all
other places using callbacks, maybe with a few simple examples.

Victor

Le dimanche 27 avril 2014, <[email protected]> a écrit :

> Hi Luca,
>
> Am Sonntag, 27. April 2014 11:01:31 UTC schrieb Luca Sbardella:
>>
>> The signal handler cannot return a coroutine.
>> If you replace:
>>
>> loop.add_signal_handler(getattr(signal, signame),
>>                                             functools.partial(ask_exit,
>> signame))
>>
>> with
>>
>> loop.add_signal_handler(getattr(signal, signame), lambda: asyncio.async(
>> ask_exit(signame)))
>>
>>
>> your example will work fine.
>> The async function runs your coroutine in the event loop.
>>
>
> This does indeed work. Thank you very much.
>

Reply via email to