1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2024-12-23 17:34:00 +03:00

manager: add MANAGER_IS_RUNNING() for checking whether the manager is running

This macro is useful as the check is not obvious, and we better abstract
this away.
This commit is contained in:
Lennart Poettering 2018-01-23 16:43:56 +01:00
parent 4adf314b77
commit 4259d20215
2 changed files with 5 additions and 4 deletions

View File

@ -3234,10 +3234,8 @@ void manager_check_finished(Manager *m) {
if (MANAGER_IS_RELOADING(m))
return;
/* Verify that we are actually running currently. Initially
* the exit code is set to invalid, and during operation it is
* then set to MANAGER_OK */
if (m->exit_code != MANAGER_OK)
/* Verify that we have entered the event loop already, and not left it again. */
if (!MANAGER_IS_RUNNING(m))
return;
manager_check_basic_target(m);

View File

@ -359,6 +359,9 @@ struct Manager {
#define MANAGER_IS_FINISHED(m) (dual_timestamp_is_set((m)->timestamps + MANAGER_TIMESTAMP_FINISH))
/* The exit code is set to OK as soon as we enter the main loop, and set otherwise as soon as we are done with it */
#define MANAGER_IS_RUNNING(m) ((m)->exit_code == MANAGER_OK)
int manager_new(UnitFileScope scope, unsigned test_run_flags, Manager **m);
Manager* manager_free(Manager *m);