diff options
Diffstat (limited to 'src/cancel.cpp')
-rw-r--r-- | src/cancel.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/cancel.cpp b/src/cancel.cpp index e08e975..2f3c22e 100644 --- a/src/cancel.cpp +++ b/src/cancel.cpp | |||
@@ -51,7 +51,7 @@ THE SOFTWARE. | |||
51 | * Returns CANCEL_SOFT/HARD if any locks are to be exited, and 'raise_cancel_error()' called, | 51 | * Returns CANCEL_SOFT/HARD if any locks are to be exited, and 'raise_cancel_error()' called, |
52 | * to make execution of the lane end. | 52 | * to make execution of the lane end. |
53 | */ | 53 | */ |
54 | static inline CancelRequest cancel_test(lua_State* L) | 54 | [[nodiscard]] static inline CancelRequest cancel_test(lua_State* L) |
55 | { | 55 | { |
56 | Lane* const lane{ LANE_POINTER_REGKEY.readLightUserDataValue<Lane>(L) }; | 56 | Lane* const lane{ LANE_POINTER_REGKEY.readLightUserDataValue<Lane>(L) }; |
57 | // 'lane' is nullptr for the original main state (and no-one can cancel that) | 57 | // 'lane' is nullptr for the original main state (and no-one can cancel that) |
@@ -76,7 +76,7 @@ LUAG_FUNC( cancel_test) | |||
76 | // ################################################################################################ | 76 | // ################################################################################################ |
77 | // ################################################################################################ | 77 | // ################################################################################################ |
78 | 78 | ||
79 | static void cancel_hook(lua_State* L, [[maybe_unused]] lua_Debug* ar) | 79 | [[nodiscard]] static void cancel_hook(lua_State* L, [[maybe_unused]] lua_Debug* ar) |
80 | { | 80 | { |
81 | DEBUGSPEW_CODE(fprintf(stderr, "cancel_hook\n")); | 81 | DEBUGSPEW_CODE(fprintf(stderr, "cancel_hook\n")); |
82 | if (cancel_test(L) != CancelRequest::None) | 82 | if (cancel_test(L) != CancelRequest::None) |
@@ -108,7 +108,7 @@ static void cancel_hook(lua_State* L, [[maybe_unused]] lua_Debug* ar) | |||
108 | 108 | ||
109 | // ################################################################################################ | 109 | // ################################################################################################ |
110 | 110 | ||
111 | static CancelResult thread_cancel_soft(Lane* lane_, lua_Duration duration_, bool wake_lane_) | 111 | [[nodiscard]] static CancelResult thread_cancel_soft(Lane* lane_, lua_Duration duration_, bool wake_lane_) |
112 | { | 112 | { |
113 | lane_->cancel_request = CancelRequest::Soft; // it's now signaled to stop | 113 | lane_->cancel_request = CancelRequest::Soft; // it's now signaled to stop |
114 | // negative timeout: we don't want to truly abort the lane, we just want it to react to cancel_test() on its own | 114 | // negative timeout: we don't want to truly abort the lane, we just want it to react to cancel_test() on its own |
@@ -126,7 +126,7 @@ static CancelResult thread_cancel_soft(Lane* lane_, lua_Duration duration_, bool | |||
126 | 126 | ||
127 | // ################################################################################################ | 127 | // ################################################################################################ |
128 | 128 | ||
129 | static CancelResult thread_cancel_hard(Lane* lane_, lua_Duration duration_, bool wake_lane_) | 129 | [[nodiscard]] static CancelResult thread_cancel_hard(Lane* lane_, lua_Duration duration_, bool wake_lane_) |
130 | { | 130 | { |
131 | lane_->cancel_request = CancelRequest::Hard; // it's now signaled to stop | 131 | lane_->cancel_request = CancelRequest::Hard; // it's now signaled to stop |
132 | //lane_->m_thread.get_stop_source().request_stop(); | 132 | //lane_->m_thread.get_stop_source().request_stop(); |
@@ -204,7 +204,7 @@ CancelOp which_cancel_op(char const* op_string_) | |||
204 | 204 | ||
205 | // ################################################################################################ | 205 | // ################################################################################################ |
206 | 206 | ||
207 | static CancelOp which_cancel_op(lua_State* L, int idx_) | 207 | [[nodiscard]] static CancelOp which_cancel_op(lua_State* L, int idx_) |
208 | { | 208 | { |
209 | if (lua_type(L, idx_) == LUA_TSTRING) | 209 | if (lua_type(L, idx_) == LUA_TSTRING) |
210 | { | 210 | { |
@@ -273,7 +273,7 @@ LUAG_FUNC(thread_cancel) | |||
273 | 273 | ||
274 | case CancelResult::Cancelled: | 274 | case CancelResult::Cancelled: |
275 | lua_pushboolean(L, 1); | 275 | lua_pushboolean(L, 1); |
276 | push_thread_status(L, lane); | 276 | std::ignore = push_thread_status(L, lane); |
277 | break; | 277 | break; |
278 | } | 278 | } |
279 | // should never happen, only here to prevent the compiler from complaining of "not all control paths returning a value" | 279 | // should never happen, only here to prevent the compiler from complaining of "not all control paths returning a value" |