From b4d7347fa8105d7c339e53e5477157f300dcddd4 Mon Sep 17 00:00:00 2001 From: Nguyen Anh Quynh Date: Sun, 30 Aug 2015 05:12:04 +0800 Subject: [PATCH] wait for the timer thread to finish at the end of uc_emu_start(). this may fix the issue #78 --- uc.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/uc.c b/uc.c index 48f810bc..6d93d0e7 100644 --- a/uc.c +++ b/uc.c @@ -549,6 +549,11 @@ uc_err uc_emu_start(uch handle, uint64_t begin, uint64_t until, uint64_t timeout // emulation is done uc->emulation_done = true; + if (timeout) { + // wait for the timer to finish + qemu_thread_join(&uc->timer); + } + return uc->invalid_error; }