audio: clean up before monitor clean up
Since aa5cb7f5e, the chardevs are being cleaned up when leaving qemu,
before the atexit() handlers. audio_cleanup() may use the monitor to
notify of changes. For compatibility reasons, let's clean up audio
before the monitor so it keeps emitting monitor events.
The audio_atexit() function is made idempotent (so it can be called
multiple times), and renamed to audio_cleanup(). Since coreaudio
backend is using a 'isAtexit' code path, change it to check
audio_is_cleaning_up() instead, so the path is taken during normal
exit.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20160801112343.29082-3-marcandre.lureau@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
diff --git a/audio/audio.h b/audio/audio.h
index 11e56c9..c3c5198 100644
--- a/audio/audio.h
+++ b/audio/audio.h
@@ -163,4 +163,7 @@
int wav_start_capture (CaptureState *s, const char *path, int freq,
int bits, int nchannels);
+bool audio_is_cleaning_up(void);
+void audio_cleanup(void);
+
#endif /* QEMU_AUDIO_H */