From 31d4f431d8267f3dfd52fae8184d09cc8c7f2529 Mon Sep 17 00:00:00 2001 From: ruki Date: Wed, 5 Nov 2025 00:55:09 +0800 Subject: fix thread exit --- xmake/core/base/thread.lua | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/xmake/core/base/thread.lua b/xmake/core/base/thread.lua index 91dd2a64d..26a6e2c52 100644 --- a/xmake/core/base/thread.lua +++ b/xmake/core/base/thread.lua @@ -914,9 +914,11 @@ function thread._run_thread(callback_str, callinfo_str) -- thread is finished, we need to notify the waited thread if wpipe then - local ok, errors = wpipe:write("1", {block = true}) - if ok < 0 then - return false, errors + if scheduler:co_running() then + local ok, errors = wpipe:write("1", {block = true}) + if ok < 0 then + return false, errors + end end wpipe:close() end -- cgit v1.3.1