vl: extract machine done notifiers

Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
Paolo Bonzini 2020-10-28 07:36:57 -04:00
parent 2c65db5e58
commit 6b21670cfd
3 changed files with 25 additions and 24 deletions

View file

@ -1169,6 +1169,30 @@ void machine_run_board_init(MachineState *machine)
machine_class->init(machine);
}
static NotifierList machine_init_done_notifiers =
NOTIFIER_LIST_INITIALIZER(machine_init_done_notifiers);
bool machine_init_done;
void qemu_add_machine_init_done_notifier(Notifier *notify)
{
notifier_list_add(&machine_init_done_notifiers, notify);
if (machine_init_done) {
notify->notify(notify, NULL);
}
}
void qemu_remove_machine_init_done_notifier(Notifier *notify)
{
notifier_remove(notify);
}
void qemu_run_machine_init_done_notifiers(void)
{
machine_init_done = true;
notifier_list_notify(&machine_init_done_notifiers, NULL);
}
static const TypeInfo machine_info = {
.name = TYPE_MACHINE,
.parent = TYPE_OBJECT,