diff options
Diffstat (limited to 'src/keeper.cpp')
-rw-r--r-- | src/keeper.cpp | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/src/keeper.cpp b/src/keeper.cpp index af8bd1a..8a99a36 100644 --- a/src/keeper.cpp +++ b/src/keeper.cpp | |||
@@ -75,21 +75,28 @@ class KeyUD | |||
75 | LindaLimit limit{ -1 }; | 75 | LindaLimit limit{ -1 }; |
76 | 76 | ||
77 | // a fifo full userdata has one uservalue, the table that holds the actual fifo contents | 77 | // a fifo full userdata has one uservalue, the table that holds the actual fifo contents |
78 | [[nodiscard]] static void* operator new([[maybe_unused]] size_t size_, KeeperState L_) noexcept { return luaG_newuserdatauv<KeyUD>(L_, UserValueCount{ 1 }); } | 78 | [[nodiscard]] |
79 | static void* operator new([[maybe_unused]] size_t size_, KeeperState L_) noexcept { return luaG_newuserdatauv<KeyUD>(L_, UserValueCount{ 1 }); } | ||
79 | // always embedded somewhere else or "in-place constructed" as a full userdata | 80 | // always embedded somewhere else or "in-place constructed" as a full userdata |
80 | // can't actually delete the operator because the compiler generates stack unwinding code that could call it in case of exception | 81 | // can't actually delete the operator because the compiler generates stack unwinding code that could call it in case of exception |
81 | static void operator delete([[maybe_unused]] void* p_, [[maybe_unused]] KeeperState L_) { LUA_ASSERT(L_, !"should never be called"); } | 82 | static void operator delete([[maybe_unused]] void* p_, [[maybe_unused]] KeeperState L_) { LUA_ASSERT(L_, !"should never be called"); } |
82 | 83 | ||
83 | [[nodiscard]] bool changeLimit(LindaLimit limit_); | 84 | [[nodiscard]] |
84 | [[nodiscard]] static KeyUD* Create(KeeperState K_); | 85 | bool changeLimit(LindaLimit limit_); |
85 | [[nodiscard]] static KeyUD* GetPtr(KeeperState K_, StackIndex idx_); | 86 | [[nodiscard]] |
87 | static KeyUD* Create(KeeperState K_); | ||
88 | [[nodiscard]] | ||
89 | static KeyUD* GetPtr(KeeperState K_, StackIndex idx_); | ||
86 | void peek(KeeperState K_, int count_) const; // keepercall_get | 90 | void peek(KeeperState K_, int count_) const; // keepercall_get |
87 | [[nodiscard]] int pop(KeeperState K_, int minCount_, int maxCount_); // keepercall_receive[_batched] | 91 | [[nodiscard]] |
92 | int pop(KeeperState K_, int minCount_, int maxCount_); // keepercall_receive[_batched] | ||
88 | void prepareAccess(KeeperState K_, StackIndex idx_) const; | 93 | void prepareAccess(KeeperState K_, StackIndex idx_) const; |
89 | [[nodiscard]] bool push(KeeperState K_, int count_, bool enforceLimit_); // keepercall_send and keepercall_set | 94 | [[nodiscard]] |
95 | bool push(KeeperState K_, int count_, bool enforceLimit_); // keepercall_send and keepercall_set | ||
90 | void pushFillStatus(KeeperState K_) const; | 96 | void pushFillStatus(KeeperState K_) const; |
91 | static void PushFillStatus(KeeperState K_, KeyUD const* key_); | 97 | static void PushFillStatus(KeeperState K_, KeyUD const* key_); |
92 | [[nodiscard]] bool reset(KeeperState K_); | 98 | [[nodiscard]] |
99 | bool reset(KeeperState K_); | ||
93 | }; | 100 | }; |
94 | 101 | ||
95 | // ################################################################################################# | 102 | // ################################################################################################# |
@@ -840,7 +847,8 @@ void Keepers::close() | |||
840 | 847 | ||
841 | // ################################################################################################# | 848 | // ################################################################################################# |
842 | 849 | ||
843 | [[nodiscard]] Keeper* Keepers::getKeeper(KeeperIndex const idx_) | 850 | [[nodiscard]] |
851 | Keeper* Keepers::getKeeper(KeeperIndex const idx_) | ||
844 | { | 852 | { |
845 | if (isClosing.test(std::memory_order_acquire)) { | 853 | if (isClosing.test(std::memory_order_acquire)) { |
846 | return nullptr; | 854 | return nullptr; |
@@ -859,7 +867,8 @@ void Keepers::close() | |||
859 | 867 | ||
860 | // ################################################################################################# | 868 | // ################################################################################################# |
861 | 869 | ||
862 | [[nodiscard]] int Keepers::getNbKeepers() const | 870 | [[nodiscard]] |
871 | int Keepers::getNbKeepers() const | ||
863 | { | 872 | { |
864 | if (isClosing.test(std::memory_order_acquire)) { | 873 | if (isClosing.test(std::memory_order_acquire)) { |
865 | return 0; | 874 | return 0; |