diff options
author | Benoit Germain <benoit.germain@ubisoft.com> | 2024-06-11 17:24:30 +0200 |
---|---|---|
committer | Benoit Germain <benoit.germain@ubisoft.com> | 2024-06-11 17:24:30 +0200 |
commit | 740b820e429cf7c856f2f305b6fc5b6fd969f3b3 (patch) | |
tree | ce885dc8200ad8c7a1f6b3506db9ceedc3cc9df7 /src/universe.cpp | |
parent | 5f5b287b4548cb21fde9ae451392d82e64cc5de7 (diff) | |
download | lanes-740b820e429cf7c856f2f305b6fc5b6fd969f3b3.tar.gz lanes-740b820e429cf7c856f2f305b6fc5b6fd969f3b3.tar.bz2 lanes-740b820e429cf7c856f2f305b6fc5b6fd969f3b3.zip |
Move some cancel-related code around
Diffstat (limited to 'src/universe.cpp')
-rw-r--r-- | src/universe.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/universe.cpp b/src/universe.cpp index 82522f1..c95884f 100644 --- a/src/universe.cpp +++ b/src/universe.cpp | |||
@@ -256,7 +256,7 @@ void Universe::terminateFreeRunningLanes(lua_State* const L_, lua_Duration const | |||
256 | // if waiting on a linda, they will raise a cancel_error. | 256 | // if waiting on a linda, they will raise a cancel_error. |
257 | // if a cancellation hook is desired, it will be installed to try to raise an error | 257 | // if a cancellation hook is desired, it will be installed to try to raise an error |
258 | if (_lane->thread.joinable()) { | 258 | if (_lane->thread.joinable()) { |
259 | std::ignore = thread_cancel(_lane, op_, 1, std::chrono::steady_clock::now() + 1us, true); | 259 | std::ignore = _lane->cancel(op_, 1, std::chrono::steady_clock::now() + 1us, true); |
260 | } | 260 | } |
261 | _lane = _lane->selfdestruct_next; | 261 | _lane = _lane->selfdestruct_next; |
262 | } | 262 | } |
@@ -316,7 +316,7 @@ LUAG_FUNC(universe_gc) | |||
316 | std::string_view const _op_string{ luaG_tostring(L_, lua_upvalueindex(2)) }; | 316 | std::string_view const _op_string{ luaG_tostring(L_, lua_upvalueindex(2)) }; |
317 | STACK_CHECK_START_ABS(L_, 1); | 317 | STACK_CHECK_START_ABS(L_, 1); |
318 | Universe* const _U{ luaG_tofulluserdata<Universe>(L_, 1) }; // L_: U | 318 | Universe* const _U{ luaG_tofulluserdata<Universe>(L_, 1) }; // L_: U |
319 | _U->terminateFreeRunningLanes(L_, _shutdown_timeout, which_cancel_op(_op_string)); | 319 | _U->terminateFreeRunningLanes(L_, _shutdown_timeout, WhichCancelOp(_op_string)); |
320 | 320 | ||
321 | // invoke the function installed by lanes.finally() | 321 | // invoke the function installed by lanes.finally() |
322 | kFinalizerRegKey.pushValue(L_); // L_: U finalizer|nil | 322 | kFinalizerRegKey.pushValue(L_); // L_: U finalizer|nil |