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 /qemu-char.c | |
parent | 3b6304f706ef7eebc0b3b3f3a5093ec75448ee19 (diff) |
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 'qemu-char.c')
-rw-r--r-- | qemu-char.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/qemu-char.c b/qemu-char.c index a3d6e64967..c02dfae43a 100644 --- a/qemu-char.c +++ b/qemu-char.c @@ -713,9 +713,15 @@ static void term_exit(void) fcntl(0, F_SETFL, old_fd0_flags); } +static void term_exit_notifier(Notifier *notifier) +{ + term_exit(); +} + static void term_init(QemuOpts *opts) { struct termios tty; + static Notifier exit_notifier = { .notify = term_exit_notifier }; tcgetattr (0, &tty); oldtty = tty; @@ -735,8 +741,9 @@ static void term_init(QemuOpts *opts) tcsetattr (0, TCSANOW, &tty); - if (!term_atexit_done++) - atexit(term_exit); + if (!term_atexit_done++) { + exit_notifier_add(&exit_notifier); + } fcntl(0, F_SETFL, O_NONBLOCK); } |