diff options
author | Anthony Liguori <aliguori@us.ibm.com> | 2010-03-17 17:59:26 -0500 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2010-03-19 15:27:38 -0500 |
commit | d7234f4d7e373a708e1df9ab565a71b71b189025 (patch) | |
tree | e4db9e84d66e448fdda3fe426fd3904eba8a5382 /vl.c | |
parent | 3b6304f706ef7eebc0b3b3f3a5093ec75448ee19 (diff) | |
download | qemu-d7234f4d7e373a708e1df9ab565a71b71b189025.zip qemu-d7234f4d7e373a708e1df9ab565a71b71b189025.tar.gz qemu-d7234f4d7e373a708e1df9ab565a71b71b189025.tar.bz2 |
Convert atexit users to exit_notifier
All of these users have global state so we really don't see a benefit from
exit_notifier. However, using exit_notifier means that there's one less
justification for having global state in the first place.
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'vl.c')
-rw-r--r-- | vl.c | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -533,7 +533,7 @@ static void configure_rtc(QemuOpts *opts) } #ifdef _WIN32 -static void socket_cleanup(void) +static void socket_cleanup(Notifier *obj) { WSACleanup(); } @@ -542,6 +542,7 @@ static int socket_init(void) { WSADATA Data; int ret, err; + static Notifier notifier = { .notify = socket_cleanup }; ret = WSAStartup(MAKEWORD(2,2), &Data); if (ret != 0) { @@ -549,7 +550,7 @@ static int socket_init(void) fprintf(stderr, "WSAStartup: %d\n", err); return -1; } - atexit(socket_cleanup); + exit_notifier_add(¬ifier); return 0; } #endif @@ -3768,6 +3769,8 @@ int main(int argc, char **argv, char **envp) error_set_progname(argv[0]); + exit_notifier_init(); + init_clocks(); qemu_cache_utils_init(envp); |