From 048881e077b6df421f60fa6fe8824ec44840ed71 Mon Sep 17 00:00:00 2001 From: jethead71 Date: Wed, 25 Jul 2007 02:15:04 +0000 Subject: [PATCH] Fix a bug that would cause a hang when shutting down from the recording screen during prerecording. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13974 a1c6a512-1295-4272-9138-f99709370657 --- apps/misc.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/apps/misc.c b/apps/misc.c index daa96b006..e72f19eda 100644 --- a/apps/misc.c +++ b/apps/misc.c @@ -653,7 +653,12 @@ static bool clean_shutdown(void (*callback)(void *), void *parameter) { #if defined(HAVE_RECORDING) && CONFIG_CODEC == SWCODEC if (audio_stat & AUDIO_STATUS_RECORD) + { audio_stop_recording(); + /* wait for stop to complete */ + while (audio_status() & AUDIO_STATUS_RECORD) + sleep(1); + } #endif /* audio_stop_recording == audio_stop for HWCODEC */ audio_stop(); @@ -661,9 +666,11 @@ static bool clean_shutdown(void (*callback)(void *), void *parameter) if (callback != NULL) callback(parameter); +#if CONFIG_CODEC != SWCODEC /* wait for audio_stop or audio_stop_recording to complete */ while (audio_status()) sleep(1); +#endif #if defined(HAVE_RECORDING) && CONFIG_CODEC == SWCODEC audio_close_recording(); -- 2.11.4.GIT