diff options
author | Kitae Kim <kt920.kim@samsung.com> | 2014-05-21 16:41:01 +0900 |
---|---|---|
committer | Kitae Kim <kt920.kim@samsung.com> | 2014-05-22 15:31:02 +0900 |
commit | 8ed62df3ef20910a6894e1f2448508311ef07da3 (patch) | |
tree | f0d42ddf332b78976703067151ce40ecc3d15142 | |
parent | 06310c2b01d87e4d62a30a260c0e7d40bdeb203a (diff) | |
download | qemu-8ed62df3ef20910a6894e1f2448508311ef07da3.tar.gz qemu-8ed62df3ef20910a6894e1f2448508311ef07da3.tar.bz2 qemu-8ed62df3ef20910a6894e1f2448508311ef07da3.zip |
maru_sdl: fix release routine
When emulator exits normally, release routine at maru_sdl causes an error.
sdl-workthread has to be destroyed before releasing condition and mutex variables.
Change-Id: I46da25cc5a5ca59284b18ff0de94a6cf27ecccc2
Signed-off-by: Kitae Kim <kt920.kim@samsung.com>
-rw-r--r-- | tizen/src/maru_sdl.c | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/tizen/src/maru_sdl.c b/tizen/src/maru_sdl.c index 3cb4ec85ba..42a985f1c6 100644 --- a/tizen/src/maru_sdl.c +++ b/tizen/src/maru_sdl.c @@ -72,6 +72,9 @@ static unsigned int blank_cnt; QemuMutex sdl_mutex; QemuCond sdl_cond; static int sdl_thread_initialized; + +QemuThread sdl_thread; +static bool sdl_thread_exit; #endif #define SDL_FLAGS (SDL_SWSURFACE | SDL_ASYNCBLIT | SDL_NOFRAME) @@ -359,16 +362,20 @@ static void qemu_update(void) #ifdef SDL_THREAD static void *run_qemu_update(void *arg) { - while(1) { - qemu_mutex_lock(&sdl_mutex); + qemu_mutex_lock(&sdl_mutex); + while (1) { qemu_cond_wait(&sdl_cond, &sdl_mutex); - + if (sdl_thread_exit) { + INFO("make SDL Thread exit\n"); + break; + } qemu_update(); - - qemu_mutex_unlock(&sdl_mutex); } + qemu_mutex_unlock(&sdl_mutex); + + INFO("finish qemu_update routine\n"); return NULL; } #endif @@ -495,7 +502,7 @@ static void maru_sdl_init_bh(void *opaque) INFO("sdl update thread create\n"); - QemuThread sdl_thread; + sdl_thread_exit = false; qemu_thread_create(&sdl_thread, "sdl-workthread", run_qemu_update, NULL, QEMU_THREAD_JOINABLE); } @@ -569,9 +576,15 @@ void maru_sdl_quit(void) SDL_Quit(); #ifdef SDL_THREAD + sdl_thread_exit = true; + qemu_cond_signal(&sdl_cond); qemu_mutex_unlock(&sdl_mutex); - qemu_cond_destroy(&sdl_cond); + INFO("join SDL thread\n"); + qemu_thread_join(&sdl_thread); + + INFO("destroy cond and mutex of SDL thread\n"); + qemu_cond_destroy(&sdl_cond); qemu_mutex_destroy(&sdl_mutex); #endif } |