From 0d94a88b4de3973ce99fd77c6731c8219444db9e Mon Sep 17 00:00:00 2001 From: Benoit Germain Date: Thu, 24 Oct 2024 16:51:33 +0200 Subject: Factorized Lane::cancelSoft/cancelHard → internalCancel MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/lane.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/lane.h') diff --git a/src/lane.h b/src/lane.h index 388ac71..a11b5f5 100644 --- a/src/lane.h +++ b/src/lane.h @@ -37,8 +37,9 @@ static constexpr RegistryUniqueKey kLaneNameRegKey{ 0xA194E2645C57F6DDull }; // The chain is ended by '(Lane*)(-1)', not nullptr: 'selfdestructFirst -> ... -> ... -> (-1)' #define SELFDESTRUCT_END ((Lane*) (-1)) +static constexpr std::string_view kLaneMetatableName{ "Lane" }; + // must be a #define instead of a constexpr to benefit from compile-time string concatenation -#define kLaneMetatableName "Lane" #define kLanesLibName "lanes" #define kLanesCoreLibName kLanesLibName ".core" @@ -140,8 +141,7 @@ class Lane private: - [[nodiscard]] CancelResult cancelHard(std::chrono::time_point until_, bool wakeLane_); - [[nodiscard]] CancelResult cancelSoft(std::chrono::time_point until_, bool wakeLane_); + [[nodiscard]] CancelResult internalCancel(CancelRequest rq_, std::chrono::time_point until_, bool wakeLane_); public: @@ -192,5 +192,5 @@ class Lane // [[nodiscard]] inline Lane* ToLane(lua_State* const L_, StackIndex const i_) { - return *(static_cast(luaL_checkudata(L_, i_, kLaneMetatableName))); + return *(static_cast(luaL_checkudata(L_, i_, kLaneMetatableName.data()))); } -- cgit v1.2.3-55-g6feb