From 1d310e6ecb6e156598337612f16573d9cd284f5e Mon Sep 17 00:00:00 2001 From: Benoit Germain Date: Tue, 19 Mar 2024 18:06:19 +0100 Subject: fix small internal issue with when hitting timeout on thread kill during thread_cancel() in pthread implementation --- CHANGES | 3 +++ src/cancel.c | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGES b/CHANGES index 89fb13d..d93f5b4 100644 --- a/CHANGES +++ b/CHANGES @@ -1,5 +1,8 @@ CHANGES: +CHANGE 159: BGe 19-Mar-24 + * fix small internal issue with when hitting timeout on thread kill during thread_cancel() in pthread implementation + CHANGE 158: BGe 22-Feb-24 * naive luajit detection in PUC-Lua-based builds, and vice-versa to detect mismatches * internal version bumped to 3.16.3 diff --git a/src/cancel.c b/src/cancel.c index 0a5adb6..d739ff9 100644 --- a/src/cancel.c +++ b/src/cancel.c @@ -156,10 +156,10 @@ static cancel_result thread_cancel_hard( lua_State* L, Lane* s, double secs_, bo #if THREADAPI == THREADAPI_PTHREAD // pthread: make sure the thread is really stopped! // note that this may block forever if the lane doesn't call a cancellation point and pthread doesn't honor PTHREAD_CANCEL_ASYNCHRONOUS - result = THREAD_WAIT( &s->thread, waitkill_timeout_, &s->done_signal, &s->done_lock, &s->status); + result = THREAD_WAIT( &s->thread, waitkill_timeout_, &s->done_signal, &s->done_lock, &s->status) ? CR_Killed : CR_Timeout; if( result == CR_Timeout) { - return luaL_error( L, "force-killed lane failed to terminate within %f second%s", waitkill_timeout_, waitkill_timeout_ > 1 ? "s" : ""); + (void) luaL_error( L, "force-killed lane failed to terminate within %f second%s", waitkill_timeout_, waitkill_timeout_ > 1 ? "s" : ""); } #else (void) waitkill_timeout_; // unused -- cgit v1.2.3-55-g6feb