From 19b35f97304375c4734965442e5f3b705e57dceb Mon Sep 17 00:00:00 2001 From: Yin Fengwei Date: Wed, 21 Nov 2018 17:50:14 +0800 Subject: [PATCH] acrn-dm: wait for monitor thread canceling finish When thread_cancel() is called to exit pthread, we can't know when the thread exit done unless pthread_join() is used to wait for thread exit. Tracked-On: #1868 Signed-off-by: Yin Fengwei Acked-by: Anthony Xu --- devicemodel/core/monitor.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/devicemodel/core/monitor.c b/devicemodel/core/monitor.c index 21a127543..f596781f4 100644 --- a/devicemodel/core/monitor.c +++ b/devicemodel/core/monitor.c @@ -183,7 +183,10 @@ static void start_intr_storm_monitor(struct vmctx *ctx) static void stop_intr_storm_monitor(void) { if (intr_storm_monitor_pid) { + void *ret; + pthread_cancel(intr_storm_monitor_pid); + pthread_join(intr_storm_monitor_pid, &ret); intr_storm_monitor_pid = 0; } }