[systemd-devel] [PATCH 1/2] Add sd_event_loop_timeout to sd_event

Didier Roche didrocks at ubuntu.com
Wed Feb 4 08:40:25 PST 2015


Le 04/02/2015 17:10, Lennart Poettering a écrit :
> On Wed, 04.02.15 17:05, Didier Roche (didrocks at ubuntu.com) wrote:
>
>> Hey,
>>
>> I rewrote a version of this patch including the feedback on the list. As per
>> IRC discussion, (and after giving up the busy loop for a rewrite with
>> epool), I did rebase it again on sd_event.
>>
>> I'm only proposing there up for review the 2 first patches (without plymouth
>> communication, cancel support, i18n, man pages and the service and socket)
>> so that I don't have to rebase all other 10 patches on a moving
>> ground.
> Tom just added support for installing timer events with a NULL
> callback, that trigger event loop exit. I kinda prefer that solution
> over a new call sd_event_loop() with timeout.
>
>       sd_event_add_time(event, NULL, CLOCK_MONOTONIC, now(CLOCK_MONOTONIC) + 5 * USEC_PER_SEC, NULL, NULL);

So, it means that I need to reset it after any received activity, is 
that ok? (as this will be really frequent as each clients in parallel 
can send a message each 50ms). The goal is to have a global "inactivity" 
timeout.

I didn't see a way to cancel this event source though?
Didier

>
> That line should be enough to mak an even loop exit after 5s...
>
> Lennart
>



More information about the systemd-devel mailing list