浏览代码

* Wake main thread when a thread is auto freed

Michaël Van Canneyt 3 月之前
父节点
当前提交
fc43e66f05
共有 1 个文件被更改,包括 3 次插入0 次删除
  1. 3 0
      rtl/wasicommon/tthread.inc

+ 3 - 0
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;