mirror of
https://github.com/systemd/systemd.git
synced 2024-11-07 09:56:51 +03:00
event: clear pending-state when re-arming timers
If a timer fires and is marked pending, but an application re-arms it before it is dispatched, we now clear the pending state. This fixes a bug where an application arms a timer, which fires and is marked pending. But before it is dispatched, the application loses interest in it and disables it. Now if the timer is re-armed and re-enabled later, it will be immediately dispatched as it is still marked pending. This behavior is unexpected, so avoid it by clearing pending state when re-arming timers. Note that applications have no way to clear pending state themselves, so there's no current workaround.
This commit is contained in:
parent
6c1508b871
commit
0cc1125ae1
@ -1241,6 +1241,7 @@ _public_ int sd_event_source_set_time(sd_event_source *s, uint64_t usec) {
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
s->time.next = usec;
|
s->time.next = usec;
|
||||||
|
source_set_pending(s, false);
|
||||||
|
|
||||||
if (s->type == SOURCE_REALTIME) {
|
if (s->type == SOURCE_REALTIME) {
|
||||||
prioq_reshuffle(s->event->realtime_earliest, s, &s->time.earliest_index);
|
prioq_reshuffle(s->event->realtime_earliest, s, &s->time.earliest_index);
|
||||||
|
Loading…
Reference in New Issue
Block a user