diff options
| author | Benoit Germain <benoit.germain@ubisoft.com> | 2025-04-28 11:17:48 +0200 |
|---|---|---|
| committer | Benoit Germain <benoit.germain@ubisoft.com> | 2025-04-28 11:17:48 +0200 |
| commit | a86327245eea5638b933aec795026699201c19e1 (patch) | |
| tree | f8d03b6abc1d0d215dd38852d1c018e8b4e84f62 /src/universe.cpp | |
| parent | d93a433732c5ca72923100f5ab8139a8a5f072b6 (diff) | |
| download | lanes-a86327245eea5638b933aec795026699201c19e1.tar.gz lanes-a86327245eea5638b933aec795026699201c19e1.tar.bz2 lanes-a86327245eea5638b933aec795026699201c19e1.zip | |
Minor internal tweaks in shutdown code
Diffstat (limited to 'src/universe.cpp')
| -rw-r--r-- | src/universe.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/universe.cpp b/src/universe.cpp index 335f056..0f41585 100644 --- a/src/universe.cpp +++ b/src/universe.cpp | |||
| @@ -178,8 +178,8 @@ Universe* Universe::Create(lua_State* const L_) | |||
| 178 | 178 | ||
| 179 | // Linked chains handling | 179 | // Linked chains handling |
| 180 | _U->selfdestructFirst = SELFDESTRUCT_END; | 180 | _U->selfdestructFirst = SELFDESTRUCT_END; |
| 181 | _U->initializeAllocatorFunction(L_); | 181 | _U->initializeAllocatorFunction(L_); // this can raise an error |
| 182 | _U->initializeOnStateCreate(L_); | 182 | _U->initializeOnStateCreate(L_); // this can raise an error |
| 183 | _U->keepers.initialize(*_U, L_, static_cast<size_t>(_nbUserKeepers), _keepers_gc_threshold); | 183 | _U->keepers.initialize(*_U, L_, static_cast<size_t>(_nbUserKeepers), _keepers_gc_threshold); |
| 184 | STACK_CHECK(L_, 0); | 184 | STACK_CHECK(L_, 0); |
| 185 | 185 | ||
| @@ -463,7 +463,11 @@ int Universe::UniverseGC(lua_State* const L_) | |||
| 463 | // that manifests as a crash inside ntdll!longjmp() function, in optimized builds only | 463 | // that manifests as a crash inside ntdll!longjmp() function, in optimized builds only |
| 464 | lua_error(L_); | 464 | lua_error(L_); |
| 465 | } | 465 | } |
| 466 | } else { | ||
| 467 | // we didn't use the error message, let's keep a clean stack | ||
| 468 | lua_pop(L_, 1); // L_: U | ||
| 466 | } | 469 | } |
| 470 | STACK_CHECK(L_, 1); | ||
| 467 | 471 | ||
| 468 | // --------------------------------------------------------- | 472 | // --------------------------------------------------------- |
| 469 | // we don't reach that point if some lanes are still running | 473 | // we don't reach that point if some lanes are still running |
| @@ -472,7 +476,9 @@ int Universe::UniverseGC(lua_State* const L_) | |||
| 472 | // no need to mutex-protect this as all lanes in the universe are gone at that point | 476 | // no need to mutex-protect this as all lanes in the universe are gone at that point |
| 473 | Linda::DeleteTimerLinda(L_, std::exchange(_U->timerLinda, nullptr), PK); | 477 | Linda::DeleteTimerLinda(L_, std::exchange(_U->timerLinda, nullptr), PK); |
| 474 | 478 | ||
| 475 | _U->keepers.close(); | 479 | if (!_U->keepers.close()) { |
| 480 | raise_luaL_error(L_, "INTERNAL ERROR: Keepers closed more than once"); | ||
| 481 | } | ||
| 476 | 482 | ||
| 477 | // remove the protected allocator, if any | 483 | // remove the protected allocator, if any |
| 478 | _U->protectedAllocator.removeFrom(L_); | 484 | _U->protectedAllocator.removeFrom(L_); |
