aboutsummaryrefslogtreecommitdiff
path: root/src/universe.cpp
diff options
context:
space:
mode:
authorBenoit Germain <benoit.germain@ubisoft.com>2024-05-07 17:56:10 +0200
committerBenoit Germain <benoit.germain@ubisoft.com>2024-05-07 17:56:10 +0200
commit6d271c5796eae14d1dc60e778435495ebfb540d8 (patch)
tree3bccba196595305ffd5f2b30f838dd39fbc5d51d /src/universe.cpp
parent5c7ef34404d3367542275d76b49f276ab035639f (diff)
downloadlanes-6d271c5796eae14d1dc60e778435495ebfb540d8.tar.gz
lanes-6d271c5796eae14d1dc60e778435495ebfb540d8.tar.bz2
lanes-6d271c5796eae14d1dc60e778435495ebfb540d8.zip
Linda API changes
* timeout clarifications (negative values are no longer accepted, use nil instead) * linda(send, linda.null, key, ...) removed, if you want to send a nil, just do it as usual
Diffstat (limited to '')
-rw-r--r--src/universe.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/universe.cpp b/src/universe.cpp
index 6adc314..becffdd 100644
--- a/src/universe.cpp
+++ b/src/universe.cpp
@@ -89,13 +89,12 @@ void Universe::terminateFreeRunningLanes(lua_State* L_, lua_Duration shutdownTim
89 { 89 {
90 std::lock_guard<std::mutex> guard{ selfdestructMutex }; 90 std::lock_guard<std::mutex> guard{ selfdestructMutex };
91 Lane* lane{ selfdestructFirst }; 91 Lane* lane{ selfdestructFirst };
92 lua_Duration timeout{ 1us };
93 while (lane != SELFDESTRUCT_END) { 92 while (lane != SELFDESTRUCT_END) {
94 // attempt the requested cancel with a small timeout. 93 // attempt the requested cancel with a small timeout.
95 // if waiting on a linda, they will raise a cancel_error. 94 // if waiting on a linda, they will raise a cancel_error.
96 // if a cancellation hook is desired, it will be installed to try to raise an error 95 // if a cancellation hook is desired, it will be installed to try to raise an error
97 if (lane->thread.joinable()) { 96 if (lane->thread.joinable()) {
98 std::ignore = thread_cancel(lane, op_, 1, timeout, true); 97 std::ignore = thread_cancel(lane, op_, 1, std::chrono::steady_clock::now() + 1us, true);
99 } 98 }
100 lane = lane->selfdestruct_next; 99 lane = lane->selfdestruct_next;
101 } 100 }