chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
sd-event: drop _likely_()
[elogind.git]
/
src
/
libsystemd
/
sd-event
/
sd-event.c
diff --git
a/src/libsystemd/sd-event/sd-event.c
b/src/libsystemd/sd-event/sd-event.c
index bf6f01cfadb68a289a0b19fffeb695f3a0a4147a..1e3afaeaccf9cb8c119a6ff7b8c277464f41ed99 100644
(file)
--- a/
src/libsystemd/sd-event/sd-event.c
+++ b/
src/libsystemd/sd-event/sd-event.c
@@
-131,6
+131,8
@@
struct clock_data {
Prioq *earliest;
Prioq *latest;
usec_t next;
Prioq *earliest;
Prioq *latest;
usec_t next;
+
+ bool needs_rearm:1;
};
struct sd_event {
};
struct sd_event {
@@
-616,6
+618,7
@@
static void source_disconnect(sd_event_source *s) {
prioq_remove(d->earliest, s, &s->time.earliest_index);
prioq_remove(d->latest, s, &s->time.latest_index);
prioq_remove(d->earliest, s, &s->time.earliest_index);
prioq_remove(d->latest, s, &s->time.latest_index);
+ d->needs_rearm = true;
break;
}
break;
}
@@
-715,6
+718,7
@@
static int source_set_pending(sd_event_source *s, bool b) {
prioq_reshuffle(d->earliest, s, &s->time.earliest_index);
prioq_reshuffle(d->latest, s, &s->time.latest_index);
prioq_reshuffle(d->earliest, s, &s->time.earliest_index);
prioq_reshuffle(d->latest, s, &s->time.latest_index);
+ d->needs_rearm = true;
}
return 0;
}
return 0;
@@
-898,6
+902,8
@@
_public_ int sd_event_add_time(
if (r < 0)
goto fail;
if (r < 0)
goto fail;
+ d->needs_rearm = true;
+
if (ret)
*ret = s;
if (ret)
*ret = s;
@@
-1408,6
+1414,7
@@
_public_ int sd_event_source_set_enabled(sd_event_source *s, int m) {
prioq_reshuffle(d->earliest, s, &s->time.earliest_index);
prioq_reshuffle(d->latest, s, &s->time.latest_index);
prioq_reshuffle(d->earliest, s, &s->time.earliest_index);
prioq_reshuffle(d->latest, s, &s->time.latest_index);
+ d->needs_rearm = true;
break;
}
break;
}
@@
-1471,6
+1478,7
@@
_public_ int sd_event_source_set_enabled(sd_event_source *s, int m) {
prioq_reshuffle(d->earliest, s, &s->time.earliest_index);
prioq_reshuffle(d->latest, s, &s->time.latest_index);
prioq_reshuffle(d->earliest, s, &s->time.earliest_index);
prioq_reshuffle(d->latest, s, &s->time.latest_index);
+ d->needs_rearm = true;
break;
}
break;
}
@@
-1548,6
+1556,7
@@
_public_ int sd_event_source_set_time(sd_event_source *s, uint64_t usec) {
prioq_reshuffle(d->earliest, s, &s->time.earliest_index);
prioq_reshuffle(d->latest, s, &s->time.latest_index);
prioq_reshuffle(d->earliest, s, &s->time.earliest_index);
prioq_reshuffle(d->latest, s, &s->time.latest_index);
+ d->needs_rearm = true;
return 0;
}
return 0;
}
@@
-1582,6
+1591,7
@@
_public_ int sd_event_source_set_time_accuracy(sd_event_source *s, uint64_t usec
assert(d);
prioq_reshuffle(d->latest, s, &s->time.latest_index);
assert(d);
prioq_reshuffle(d->latest, s, &s->time.latest_index);
+ d->needs_rearm = true;
return 0;
}
return 0;
}
@@
-1745,6
+1755,11
@@
static int event_arm_timer(
assert(e);
assert(d);
assert(e);
assert(d);
+ if (!d->needs_rearm)
+ return 0;
+ else
+ d->needs_rearm = false;
+
a = prioq_peek(d->earliest);
if (!a || a->enabled == SD_EVENT_OFF) {
a = prioq_peek(d->earliest);
if (!a || a->enabled == SD_EVENT_OFF) {