From 59ce64b638a69f6796bef706a54d81069ce8cd88 Mon Sep 17 00:00:00 2001 From: Christian Prochaska Date: Mon, 26 Jun 2023 12:44:06 +0200 Subject: [PATCH] monitor: handle `Monitored_thread` case in `kill_thread()` Fixes #4934 --- repos/os/src/monitor/inferior_cpu.h | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/repos/os/src/monitor/inferior_cpu.h b/repos/os/src/monitor/inferior_cpu.h index 436e7b11bc..1ed1d349e8 100644 --- a/repos/os/src/monitor/inferior_cpu.h +++ b/repos/os/src/monitor/inferior_cpu.h @@ -73,8 +73,16 @@ struct Monitor::Inferior_cpu : Monitored_cpu_session return result; } - void kill_thread(Thread_capability thread) override { - _real.call(thread); } + void kill_thread(Thread_capability thread) override + { + Monitored_thread::with_thread(_ep, thread, + [&] (Monitored_thread &monitored_thread) { + _real.call(monitored_thread._real); + destroy(_alloc, &monitored_thread); }, + [&] { + _real.call(thread); } + ); + } void exception_sigh(Signal_context_capability sigh) override { _real.call(sigh); }