mirror of
https://github.com/morgan9e/systemd
synced 2026-04-14 00:14:32 +09:00
sd-event: Move SOURCE_POST check into mark_post_sources_pending()
Rename to maybe_mark_post_sources_pending() as well to match the new
behavior.
Follow up for 4c8b6d636c
This commit is contained in:
@@ -4079,10 +4079,13 @@ static int source_memory_pressure_initiate_dispatch(sd_event_source *s) {
|
|||||||
return 0; /* go on, dispatch to user callback */
|
return 0; /* go on, dispatch to user callback */
|
||||||
}
|
}
|
||||||
|
|
||||||
static int mark_post_sources_pending(sd_event *e) {
|
static int maybe_mark_post_sources_pending(EventSourceType t, sd_event *e) {
|
||||||
sd_event_source *z;
|
sd_event_source *z;
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
|
if (t == SOURCE_POST)
|
||||||
|
return 0;
|
||||||
|
|
||||||
SET_FOREACH(z, e->post_sources) {
|
SET_FOREACH(z, e->post_sources) {
|
||||||
if (event_source_is_offline(z))
|
if (event_source_is_offline(z))
|
||||||
continue;
|
continue;
|
||||||
@@ -4134,12 +4137,10 @@ static int source_dispatch(sd_event_source *s) {
|
|||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (s->type != SOURCE_POST) {
|
/* If we execute a non-post source, let's mark all post sources as pending. */
|
||||||
/* If we execute a non-post source, let's mark all post sources as pending. */
|
r = maybe_mark_post_sources_pending(s->type, s->event);
|
||||||
r = mark_post_sources_pending(s->event);
|
if (r < 0)
|
||||||
if (r < 0)
|
return r;
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (s->type == SOURCE_MEMORY_PRESSURE) {
|
if (s->type == SOURCE_MEMORY_PRESSURE) {
|
||||||
r = source_memory_pressure_initiate_dispatch(s);
|
r = source_memory_pressure_initiate_dispatch(s);
|
||||||
@@ -4248,13 +4249,11 @@ static int source_dispatch(sd_event_source *s) {
|
|||||||
|
|
||||||
s->dispatching = false;
|
s->dispatching = false;
|
||||||
|
|
||||||
if (saved_type != SOURCE_POST) {
|
/* More post sources might have been added while executing the callback, let's make sure
|
||||||
/* More post sources might have been added while executing the callback, let's make sure
|
* those are marked pending as well. */
|
||||||
* those are marked pending as well. */
|
r = maybe_mark_post_sources_pending(saved_type, saved_event);
|
||||||
r = mark_post_sources_pending(saved_event);
|
if (r < 0)
|
||||||
if (r < 0)
|
return r;
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
|
||||||
finish:
|
finish:
|
||||||
if (r < 0) {
|
if (r < 0) {
|
||||||
|
|||||||
Reference in New Issue
Block a user