diff options
Diffstat (limited to '')
-rw-r--r-- | src/lindafactory.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/lindafactory.cpp b/src/lindafactory.cpp index 6a2b000..9a75b4f 100644 --- a/src/lindafactory.cpp +++ b/src/lindafactory.cpp | |||
@@ -70,19 +70,20 @@ void LindaFactory::deleteDeepObjectInternal(lua_State* L_, DeepPrelude* o_) cons | |||
70 | { | 70 | { |
71 | Linda* const _linda{ static_cast<Linda*>(o_) }; | 71 | Linda* const _linda{ static_cast<Linda*>(o_) }; |
72 | LUA_ASSERT(L_, _linda && !_linda->inKeeperOperation()); | 72 | LUA_ASSERT(L_, _linda && !_linda->inKeeperOperation()); |
73 | Keeper* const _myK{ _linda->whichKeeper() }; | 73 | Keeper* const _myKeeper{ _linda->whichKeeper() }; |
74 | // if collected after the universe, keepers are already destroyed, and there is nothing to clear | 74 | // if collected after the universe, keepers are already destroyed, and there is nothing to clear |
75 | if (_myK) { | 75 | if (_myKeeper) { |
76 | // if collected from my own keeper, we can't acquire/release it | 76 | // if collected from my own keeper, we can't acquire/release it |
77 | // because we are already inside a protected area, and trying to do so would deadlock! | 77 | // because we are already inside a protected area, and trying to do so would deadlock! |
78 | bool const _need_acquire_release{ _myK->L != L_ }; | 78 | bool const _need_acquire_release{ _myKeeper->K != L_ }; |
79 | // Clean associated structures in the keeper state. | 79 | // Clean associated structures in the keeper state. |
80 | Keeper* const _K{ _need_acquire_release ? _linda->acquireKeeper() : _myK }; | 80 | Keeper* const _keeper{ _need_acquire_release ? _linda->acquireKeeper() : _myKeeper }; |
81 | LUA_ASSERT(L_, _keeper == _myKeeper); // should always be the same | ||
81 | // hopefully this won't ever raise an error as we would jump to the closest pcall site while forgetting to release the keeper mutex... | 82 | // hopefully this won't ever raise an error as we would jump to the closest pcall site while forgetting to release the keeper mutex... |
82 | [[maybe_unused]] KeeperCallResult const result{ keeper_call(_K->L, KEEPER_API(destruct), L_, _linda, 0) }; | 83 | [[maybe_unused]] KeeperCallResult const result{ keeper_call(_keeper->K, KEEPER_API(destruct), L_, _linda, 0) }; |
83 | LUA_ASSERT(L_, result.has_value() && result.value() == 0); | 84 | LUA_ASSERT(L_, result.has_value() && result.value() == 0); |
84 | if (_need_acquire_release) { | 85 | if (_need_acquire_release) { |
85 | _linda->releaseKeeper(_K); | 86 | _linda->releaseKeeper(_keeper); |
86 | } | 87 | } |
87 | } | 88 | } |
88 | 89 | ||