From c860f557a7ba72e6a39ea5db36e293de802adea5 Mon Sep 17 00:00:00 2001 From: Benoit Germain Date: Fri, 25 Oct 2024 16:45:28 +0200 Subject: New linda:wake() and linda.status --- src/linda.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/linda.h') diff --git a/src/linda.h b/src/linda.h index c05fb14..02b0514 100644 --- a/src/linda.h +++ b/src/linda.h @@ -40,7 +40,15 @@ class Linda } }; + enum class Status + { + Active, + Cancelled + }; + using enum Status; + private: + static constexpr size_t kEmbeddedNameLength = 24; using EmbeddedName = std::array; // depending on the name length, it is either embedded inside the Linda, or allocated separately @@ -53,7 +61,7 @@ class Linda std::condition_variable writeHappened{}; Universe* const U{ nullptr }; // the universe this linda belongs to KeeperIndex const keeperIndex{ -1 }; // the keeper associated to this linda - CancelRequest cancelRequest{ CancelRequest::None }; + Status cancelStatus{ Status::Active }; public: [[nodiscard]] static void* operator new(size_t size_, Universe* U_) noexcept { return U_->internalAllocator.alloc(size_); } @@ -89,6 +97,7 @@ class Linda }; void releaseKeeper(Keeper* keeper_) const; [[nodiscard]] static int ProtectedCall(lua_State* L_, lua_CFunction f_); + void pushCancelString(lua_State* L_) const; [[nodiscard]] KeeperOperationInProgress startKeeperOperation(lua_State* const L_) { return KeeperOperationInProgress{ *this, L_ }; }; [[nodiscard]] Keeper* whichKeeper() const { return U->keepers.getKeeper(keeperIndex); } }; -- cgit v1.2.3-55-g6feb