aboutsummaryrefslogtreecommitdiff
path: root/src/keeper.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/keeper.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/keeper.cpp b/src/keeper.cpp
index 46f580b..bea91a7 100644
--- a/src/keeper.cpp
+++ b/src/keeper.cpp
@@ -790,7 +790,7 @@ int Keeper::PushLindaStorage(Linda& linda_, DestState const L_)
790 790
791void Keepers::DeleteKV::operator()(Keeper* const k_) const 791void Keepers::DeleteKV::operator()(Keeper* const k_) const
792{ 792{
793 for (Keeper& _k : std::views::counted(k_, count)) { 793 for (auto& _k : std::span<Keeper>(k_, count)) {
794 _k.~Keeper(); 794 _k.~Keeper();
795 } 795 }
796 U->internalAllocator.free(k_, count * sizeof(Keeper)); 796 U->internalAllocator.free(k_, count * sizeof(Keeper));
@@ -826,7 +826,7 @@ void Keepers::close()
826 // when keeper N+1 is closed, object is GCed, linda operation is called, which attempts to acquire keeper N, whose Lua state no longer exists 826 // when keeper N+1 is closed, object is GCed, linda operation is called, which attempts to acquire keeper N, whose Lua state no longer exists
827 // in that case, the linda operation should do nothing. which means that these operations must check for keeper acquisition success 827 // in that case, the linda operation should do nothing. which means that these operations must check for keeper acquisition success
828 // which is early-outed with a keepers->nbKeepers null-check 828 // which is early-outed with a keepers->nbKeepers null-check
829 size_t const _nbKeepers{ std::exchange(_kv.nbKeepers, 0) }; 829 size_t const _nbKeepers{ std::exchange(_kv.nbKeepers, size_t{ 0 }) };
830 for (size_t const _i : std::ranges::iota_view{ size_t{ 0 }, _nbKeepers }) { 830 for (size_t const _i : std::ranges::iota_view{ size_t{ 0 }, _nbKeepers }) {
831 if (!_closeOneKeeper(_kv.keepers[_i])) { 831 if (!_closeOneKeeper(_kv.keepers[_i])) {
832 // detected partial init: destroy only the mutexes that got initialized properly 832 // detected partial init: destroy only the mutexes that got initialized properly
@@ -889,7 +889,7 @@ void Keepers::close()
889 * settings table is expected at position 1 on the stack 889 * settings table is expected at position 1 on the stack
890 */ 890 */
891 891
892void Keepers::initialize(Universe& U_, lua_State* L_, int const nbKeepers_, int const gc_threshold_) 892void Keepers::initialize(Universe& U_, lua_State* L_, size_t const nbKeepers_, int const gc_threshold_)
893{ 893{
894 gc_threshold = gc_threshold_; 894 gc_threshold = gc_threshold_;
895 895
@@ -945,7 +945,7 @@ void Keepers::initialize(Universe& U_, lua_State* L_, int const nbKeepers_, int
945 U->callOnStateCreate(_K, L, LookupMode::ToKeeper); 945 U->callOnStateCreate(_K, L, LookupMode::ToKeeper);
946 946
947 // _R[kLindasRegKey] = {} 947 // _R[kLindasRegKey] = {}
948 kLindasRegKey.setValue(_K, [](lua_State* L_) { lua_newtable(L_); }); 948 kLindasRegKey.setValue(_K, [](lua_State* const L_) { lua_newtable(L_); });
949 STACK_CHECK(_K, 0); 949 STACK_CHECK(_K, 0);
950 950
951 // configure GC last 951 // configure GC last
@@ -968,8 +968,8 @@ void Keepers::initialize(Universe& U_, lua_State* L_, int const nbKeepers_, int
968 std::unique_ptr<Keeper[], DeleteKV>{ new(&U_) Keeper[nbKeepers_], DeleteKV{ &U_, nbKeepers_ } }, 968 std::unique_ptr<Keeper[], DeleteKV>{ new(&U_) Keeper[nbKeepers_], DeleteKV{ &U_, nbKeepers_ } },
969 nbKeepers_ 969 nbKeepers_
970 ); 970 );
971 for (int const _i : std::ranges::iota_view{ 0, nbKeepers_ }) { 971 for (size_t const _i : std::ranges::iota_view{ size_t{ 0 }, nbKeepers_ }) {
972 _initOneKeeper(_kv.keepers[_i], _i); 972 _initOneKeeper(_kv.keepers[_i], static_cast<int>(_i));
973 } 973 }
974 } 974 }
975} 975}