diff options
author | Benoit Germain <benoit.germain@ubisoft.com> | 2024-04-08 16:57:53 +0200 |
---|---|---|
committer | Benoit Germain <benoit.germain@ubisoft.com> | 2024-04-08 17:00:56 +0200 |
commit | 96daea993eeea17f0c64325491943e48795ff751 (patch) | |
tree | 653072dc81d0360382576b520e19619b0e06d085 /src/cancel.h | |
parent | 63b930ebc5060efecea0ec3acf7e5c93e4047864 (diff) | |
download | lanes-96daea993eeea17f0c64325491943e48795ff751.tar.gz lanes-96daea993eeea17f0c64325491943e48795ff751.tar.bz2 lanes-96daea993eeea17f0c64325491943e48795ff751.zip |
C++ migration: use std::jthread, std::condition_variable, std::chrono.
win32 pthread support is gone
new setting configure.shutdown_mode for cancellation of free-running threads at shutdown.
no more hard thread termination! If a thread doesn't cooperate, an error is raised.
lane.status "killed" is gone
lane:cancel can't force-kill.
Diffstat (limited to 'src/cancel.h')
-rw-r--r-- | src/cancel.h | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/cancel.h b/src/cancel.h index 884e193..954b04e 100644 --- a/src/cancel.h +++ b/src/cancel.h | |||
@@ -13,6 +13,8 @@ extern "C" { | |||
13 | #include "uniquekey.h" | 13 | #include "uniquekey.h" |
14 | #include "macros_and_utils.h" | 14 | #include "macros_and_utils.h" |
15 | 15 | ||
16 | #include <chrono> | ||
17 | |||
16 | // ################################################################################################ | 18 | // ################################################################################################ |
17 | 19 | ||
18 | class Lane; // forward | 20 | class Lane; // forward |
@@ -30,8 +32,7 @@ enum class CancelRequest | |||
30 | enum class CancelResult | 32 | enum class CancelResult |
31 | { | 33 | { |
32 | Timeout, | 34 | Timeout, |
33 | Cancelled, | 35 | Cancelled |
34 | Killed | ||
35 | }; | 36 | }; |
36 | 37 | ||
37 | enum class CancelOp | 38 | enum class CancelOp |
@@ -48,7 +49,8 @@ enum class CancelOp | |||
48 | // crc64/we of string "CANCEL_ERROR" generated at http://www.nitrxgen.net/hashgen/ | 49 | // crc64/we of string "CANCEL_ERROR" generated at http://www.nitrxgen.net/hashgen/ |
49 | static constexpr UniqueKey CANCEL_ERROR{ 0xe97d41626cc97577ull }; // 'raise_cancel_error' sentinel | 50 | static constexpr UniqueKey CANCEL_ERROR{ 0xe97d41626cc97577ull }; // 'raise_cancel_error' sentinel |
50 | 51 | ||
51 | CancelResult thread_cancel(lua_State* L, Lane* lane_, CancelOp op_, double secs_, bool force_, double waitkill_timeout_); | 52 | CancelOp which_cancel_op(char const* op_string_); |
53 | CancelResult thread_cancel(Lane* lane_, CancelOp op_, int hook_count_, lua_Duration secs_, bool wake_lindas_); | ||
52 | 54 | ||
53 | [[noreturn]] static inline void raise_cancel_error(lua_State* L) | 55 | [[noreturn]] static inline void raise_cancel_error(lua_State* L) |
54 | { | 56 | { |