diff options
Diffstat (limited to 'src/keeper.cpp')
-rw-r--r-- | src/keeper.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/keeper.cpp b/src/keeper.cpp index 5350d26..763bcf7 100644 --- a/src/keeper.cpp +++ b/src/keeper.cpp | |||
@@ -580,7 +580,7 @@ void close_keepers(Universe* U_) | |||
580 | U_->keepers->keeper_array[i].~Keeper(); | 580 | U_->keepers->keeper_array[i].~Keeper(); |
581 | } | 581 | } |
582 | // free the keeper bookkeeping structure | 582 | // free the keeper bookkeeping structure |
583 | U_->internal_allocator.free(U_->keepers, sizeof(Keepers) + (nbKeepers - 1) * sizeof(Keeper)); | 583 | U_->internalAllocator.free(U_->keepers, sizeof(Keepers) + (nbKeepers - 1) * sizeof(Keeper)); |
584 | U_->keepers = nullptr; | 584 | U_->keepers = nullptr; |
585 | } | 585 | } |
586 | } | 586 | } |
@@ -618,7 +618,7 @@ void init_keepers(Universe* U_, lua_State* L_) | |||
618 | // Keepers contains an array of 1 Keeper, adjust for the actual number of keeper states | 618 | // Keepers contains an array of 1 Keeper, adjust for the actual number of keeper states |
619 | { | 619 | { |
620 | size_t const bytes = sizeof(Keepers) + (nb_keepers - 1) * sizeof(Keeper); | 620 | size_t const bytes = sizeof(Keepers) + (nb_keepers - 1) * sizeof(Keeper); |
621 | U_->keepers = static_cast<Keepers*>(U_->internal_allocator.alloc(bytes)); | 621 | U_->keepers = static_cast<Keepers*>(U_->internalAllocator.alloc(bytes)); |
622 | if (U_->keepers == nullptr) { | 622 | if (U_->keepers == nullptr) { |
623 | raise_luaL_error(L_, "init_keepers() failed while creating keeper array; out of memory"); | 623 | raise_luaL_error(L_, "init_keepers() failed while creating keeper array; out of memory"); |
624 | } | 624 | } |
@@ -675,7 +675,7 @@ void init_keepers(Universe* U_, lua_State* L_) | |||
675 | // attempt to call on_state_create(), if we have one and it is a C function | 675 | // attempt to call on_state_create(), if we have one and it is a C function |
676 | // (only support a C function because we can't transfer executable Lua code in keepers) | 676 | // (only support a C function because we can't transfer executable Lua code in keepers) |
677 | // will raise an error in L_ in case of problem | 677 | // will raise an error in L_ in case of problem |
678 | call_on_state_create(U_, K, L_, LookupMode::ToKeeper); | 678 | callOnStateCreate(U_, K, L_, LookupMode::ToKeeper); |
679 | 679 | ||
680 | // to see VM name in Decoda debugger | 680 | // to see VM name in Decoda debugger |
681 | lua_pushfstring(K, "Keeper #%d", i + 1); // L_: settings K: "Keeper #n" | 681 | lua_pushfstring(K, "Keeper #%d", i + 1); // L_: settings K: "Keeper #n" |
@@ -694,8 +694,8 @@ Keeper* Linda::acquireKeeper() const | |||
694 | int const nbKeepers{ U->keepers->nb_keepers }; | 694 | int const nbKeepers{ U->keepers->nb_keepers }; |
695 | // can be 0 if this happens during main state shutdown (lanes is being GC'ed -> no keepers) | 695 | // can be 0 if this happens during main state shutdown (lanes is being GC'ed -> no keepers) |
696 | if (nbKeepers) { | 696 | if (nbKeepers) { |
697 | Keeper* const K{ &U->keepers->keeper_array[m_keeper_index] }; | 697 | Keeper* const K{ &U->keepers->keeper_array[keeperIndex] }; |
698 | K->m_mutex.lock(); | 698 | K->mutex.lock(); |
699 | return K; | 699 | return K; |
700 | } | 700 | } |
701 | return nullptr; | 701 | return nullptr; |
@@ -706,8 +706,8 @@ Keeper* Linda::acquireKeeper() const | |||
706 | void Linda::releaseKeeper(Keeper* K_) const | 706 | void Linda::releaseKeeper(Keeper* K_) const |
707 | { | 707 | { |
708 | if (K_) { // can be nullptr if we tried to acquire during shutdown | 708 | if (K_) { // can be nullptr if we tried to acquire during shutdown |
709 | assert(K_ == &U->keepers->keeper_array[m_keeper_index]); | 709 | assert(K_ == &U->keepers->keeper_array[keeperIndex]); |
710 | K_->m_mutex.unlock(); | 710 | K_->mutex.unlock(); |
711 | } | 711 | } |
712 | } | 712 | } |
713 | 713 | ||