From fc43e66f05361eae720d140f9b5613f431aa1967 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Van=20Canneyt?= Date: Thu, 3 Apr 2025 17:12:20 +0200 Subject: [PATCH] * Wake main thread when a thread is auto freed --- rtl/wasicommon/tthread.inc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/rtl/wasicommon/tthread.inc b/rtl/wasicommon/tthread.inc index c77aa7d8a4..601889ff06 100644 --- a/rtl/wasicommon/tthread.inc +++ b/rtl/wasicommon/tthread.inc @@ -184,6 +184,9 @@ begin Resume; end; {$IFDEF DEBUGWASMTHREADS}DebugWriteln('TThread.SysDestroy: waiting on thread');{$ENDIF} + // Before calling WaitFor, signal main thread with WakeMainThread, so pending checksynchronize calls are handled. + if assigned(WakeMainThread) then + WakeMainThread(Self); WaitFor; end; end;