mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-06 09:13:55 -06:00
Add exit notifiers
Like atexit() but with state Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
parent
3af12c86d9
commit
3b6304f706
2 changed files with 32 additions and 0 deletions
27
vl.c
27
vl.c
|
@ -150,6 +150,7 @@ int main(int argc, char **argv)
|
|||
#include "qemu-option.h"
|
||||
#include "qemu-config.h"
|
||||
#include "qemu-objects.h"
|
||||
#include "notify.h"
|
||||
|
||||
#include "disas.h"
|
||||
|
||||
|
@ -553,6 +554,32 @@ static int socket_init(void)
|
|||
}
|
||||
#endif
|
||||
|
||||
/*********************/
|
||||
/* Exit notifiers */
|
||||
/*********************/
|
||||
|
||||
static NotifierList exit_notifiers = NOTIFIER_LIST_INITIALIZER(exit_notifiers);
|
||||
|
||||
void exit_notifier_add(Notifier *notifier)
|
||||
{
|
||||
notifier_list_add(&exit_notifiers, notifier);
|
||||
}
|
||||
|
||||
void exit_notifier_remove(Notifier *notifier)
|
||||
{
|
||||
notifier_list_remove(&exit_notifiers, notifier);
|
||||
}
|
||||
|
||||
static void exit_notifier_notify(void)
|
||||
{
|
||||
notifier_list_notify(&exit_notifiers);
|
||||
}
|
||||
|
||||
static void exit_notifier_init(void)
|
||||
{
|
||||
atexit(exit_notifier_notify);
|
||||
}
|
||||
|
||||
/***********************************************************/
|
||||
/* Bluetooth support */
|
||||
static int nb_hcis;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue