diff options
author | Benoit Germain <benoit.germain@ubisoft.com> | 2024-03-19 18:06:19 +0100 |
---|---|---|
committer | Benoit Germain <benoit.germain@ubisoft.com> | 2024-03-19 18:06:19 +0100 |
commit | 1d310e6ecb6e156598337612f16573d9cd284f5e (patch) | |
tree | 1390f339373a95ba9f37da0209426d0660d71e17 | |
parent | 352c7bec48f166e34fa94f7481882a8b5958e15c (diff) | |
download | lanes-1d310e6ecb6e156598337612f16573d9cd284f5e.tar.gz lanes-1d310e6ecb6e156598337612f16573d9cd284f5e.tar.bz2 lanes-1d310e6ecb6e156598337612f16573d9cd284f5e.zip |
fix small internal issue with when hitting timeout on thread kill during thread_cancel() in pthread implementation
-rw-r--r-- | CHANGES | 3 | ||||
-rw-r--r-- | src/cancel.c | 4 |
2 files changed, 5 insertions, 2 deletions
@@ -1,5 +1,8 @@ | |||
1 | CHANGES: | 1 | CHANGES: |
2 | 2 | ||
3 | CHANGE 159: BGe 19-Mar-24 | ||
4 | * fix small internal issue with when hitting timeout on thread kill during thread_cancel() in pthread implementation | ||
5 | |||
3 | CHANGE 158: BGe 22-Feb-24 | 6 | CHANGE 158: BGe 22-Feb-24 |
4 | * naive luajit detection in PUC-Lua-based builds, and vice-versa to detect mismatches | 7 | * naive luajit detection in PUC-Lua-based builds, and vice-versa to detect mismatches |
5 | * internal version bumped to 3.16.3 | 8 | * 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 | |||
156 | #if THREADAPI == THREADAPI_PTHREAD | 156 | #if THREADAPI == THREADAPI_PTHREAD |
157 | // pthread: make sure the thread is really stopped! | 157 | // pthread: make sure the thread is really stopped! |
158 | // note that this may block forever if the lane doesn't call a cancellation point and pthread doesn't honor PTHREAD_CANCEL_ASYNCHRONOUS | 158 | // note that this may block forever if the lane doesn't call a cancellation point and pthread doesn't honor PTHREAD_CANCEL_ASYNCHRONOUS |
159 | result = THREAD_WAIT( &s->thread, waitkill_timeout_, &s->done_signal, &s->done_lock, &s->status); | 159 | result = THREAD_WAIT( &s->thread, waitkill_timeout_, &s->done_signal, &s->done_lock, &s->status) ? CR_Killed : CR_Timeout; |
160 | if( result == CR_Timeout) | 160 | if( result == CR_Timeout) |
161 | { | 161 | { |
162 | return luaL_error( L, "force-killed lane failed to terminate within %f second%s", waitkill_timeout_, waitkill_timeout_ > 1 ? "s" : ""); | 162 | (void) luaL_error( L, "force-killed lane failed to terminate within %f second%s", waitkill_timeout_, waitkill_timeout_ > 1 ? "s" : ""); |
163 | } | 163 | } |
164 | #else | 164 | #else |
165 | (void) waitkill_timeout_; // unused | 165 | (void) waitkill_timeout_; // unused |