return 0;
}
-#if 0 /// UNNEEDED by elogind
_public_ int sd_event_add_child(
sd_event *e,
sd_event_source **ret,
return 0;
}
-#endif // 0
_public_ int sd_event_add_post(
sd_event *e,
return s->signal.sig;
}
+#endif // 0
_public_ int sd_event_source_get_priority(sd_event_source *s, int64_t *priority) {
assert_return(s, -EINVAL);
assert_return(!event_pid_changed(s->event), -ECHILD);
- return s->priority;
+ *priority = s->priority;
+ return 0;
}
-#endif // 0
_public_ int sd_event_source_set_priority(sd_event_source *s, int64_t priority) {
int r;
}
static int source_dispatch(sd_event_source *s) {
+ EventSourceType saved_type;
int r = 0;
assert(s);
assert(s->pending || s->type == SOURCE_EXIT);
+ /* Save the event source type, here, so that we still know it after the event callback which might invalidate
+ * the event. */
+ saved_type = s->type;
+
if (s->type != SOURCE_DEFER && s->type != SOURCE_EXIT) {
r = source_set_pending(s, false);
if (r < 0)
if (r < 0)
log_debug_errno(r, "Event source %s (type %s) returned error, disabling: %m",
- strna(s->description), event_source_type_to_string(s->type));
+ strna(s->description), event_source_type_to_string(saved_type));
if (s->n_ref == 0)
source_free(s);
return r;
}
-#if 0 /// UNNEEDED by elogind
_public_ int sd_event_loop(sd_event *e) {
int r;
return r;
}
+#if 0 /// UNNEEDED by elogind
_public_ int sd_event_get_fd(sd_event *e) {
assert_return(e, -EINVAL);
return 0;
}
-#if 0 /// UNNEEDED by elogind
_public_ int sd_event_now(sd_event *e, clockid_t clock, uint64_t *usec) {
assert_return(e, -EINVAL);
assert_return(usec, -EINVAL);
*usec = triple_timestamp_by_clock(&e->timestamp, clock);
return 0;
}
-#endif // 0
_public_ int sd_event_default(sd_event **ret) {