From 76da2875eb2af9f8191c2adf4f9663ac3a2cec89 Mon Sep 17 00:00:00 2001 From: Benoit Germain Date: Mon, 28 Oct 2024 17:57:31 +0100 Subject: Renamed allocator.h → allocator.hpp, cancel.h → cancel.hpp, keeper.h → keeper.hpp, tools.h → tools.hpp MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/cancel.h | 60 ------------------------------------------------------------ 1 file changed, 60 deletions(-) delete mode 100644 src/cancel.h (limited to 'src/cancel.h') diff --git a/src/cancel.h b/src/cancel.h deleted file mode 100644 index 7230169..0000000 --- a/src/cancel.h +++ /dev/null @@ -1,60 +0,0 @@ -#pragma once - -#include "macros_and_utils.hpp" -#include "uniquekey.hpp" - -// ################################################################################################# - -// Lane cancellation request modes -enum class CancelRequest -{ - None, // no pending cancel request - // TODO: add a Wake mode: user wants to wake the waiting lindas (in effect resulting in a timeout before the initial operation duration) - Soft, // user wants the lane to cancel itself manually on cancel_test() - Hard // user wants the lane to be interrupted (meaning code won't return from those functions) from inside linda:send/receive calls -}; - -enum class CancelResult -{ - Timeout, - Cancelled -}; - -enum class CancelOp -{ - Invalid = -2, - Hard = -1, - Soft = 0, - MaskCall = LUA_MASKCALL, - MaskRet = LUA_MASKRET, - MaskLine = LUA_MASKLINE, - MaskCount = LUA_MASKCOUNT, - MaskAll = LUA_MASKCALL | LUA_MASKRET | LUA_MASKLINE | LUA_MASKCOUNT -}; - -inline auto operator<=>(CancelOp const a_, CancelOp const b_) -{ - return static_cast>(a_) <=> static_cast>(b_); -} - -// xxh64 of string "kCancelError" generated at https://www.pelock.com/products/hash-calculator -static constexpr UniqueKey kCancelError{ 0x0630345FEF912746ull, "lanes.cancel_error" }; // 'raise_cancel_error' sentinel - -// ################################################################################################# - -[[nodiscard]] CancelRequest CheckCancelRequest(lua_State* L_); -[[nodiscard]] CancelOp WhichCancelOp(std::string_view const& opString_); - -// ################################################################################################# - -[[noreturn]] static inline void raise_cancel_error(lua_State* const L_) -{ - STACK_GROW(L_, 1); - kCancelError.pushKey(L_); // special error value - raise_lua_error(L_); -} - -// ################################################################################################# - -LUAG_FUNC(cancel_test); -LUAG_FUNC(lane_cancel); -- cgit v1.2.3-55-g6feb