[*] Updated deinit
This commit is contained in:
parent
7223071877
commit
eb4e40d548
@ -107,27 +107,50 @@ static void RuntimeLateClean();
|
|||||||
static void Deinit()
|
static void Deinit()
|
||||||
{
|
{
|
||||||
//tlsHackIsMainThread = true;
|
//tlsHackIsMainThread = true;
|
||||||
|
|
||||||
gRuntimeRunLevel = 3;
|
gRuntimeRunLevel = 3;
|
||||||
Aurora::Exit::PostLevel(AuThreads::GetThread(), Aurora::Exit::ETriggerLevel::eSafeTermination);
|
Aurora::Exit::PostLevel(AuThreads::GetThread(), Aurora::Exit::ETriggerLevel::eSafeTermination);
|
||||||
gRuntimeRunLevel = 4;
|
gRuntimeRunLevel = 4;
|
||||||
Aurora::RNG::Release();
|
|
||||||
Aurora::Async::ShutdownAsync();
|
Aurora::Async::ShutdownAsync();
|
||||||
|
|
||||||
RuntimeLateClean();
|
RuntimeLateClean();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void RuntimeLateClean()
|
static void RuntimeLateClean()
|
||||||
{
|
{
|
||||||
Aurora::Console::Exit();
|
// TODO: elevate leval, freeze all threads
|
||||||
Aurora::Grug::DeinitGrug(); // TODO: this was once broken above "deinit" for some unix crash reason.
|
|
||||||
Aurora::Processes::Deinit(); // now that the runtime is far more stable, im putting this down here to ensure
|
|
||||||
Aurora::Exit::DeinitExit(); // console exit doesnt slam into a deadlocked grug thread.
|
|
||||||
Aurora::IO::Deinit();
|
|
||||||
|
|
||||||
|
Aurora::Console::Exit(); // Final flush (i hope? coping?)
|
||||||
|
|
||||||
|
Aurora::Grug::DeinitGrug(); // TODO: this was once broken above "deinit" for some unix crash reason.
|
||||||
|
// now that the runtime is far more stable, im putting this down here to ensure
|
||||||
|
// console exit doesnt slam into a deadlocked grug thread.
|
||||||
|
|
||||||
|
Aurora::Processes::Deinit();
|
||||||
|
|
||||||
|
// Static variables we should probably manually release ->
|
||||||
|
// (there is no real logic under the following functions)
|
||||||
|
Aurora::IO::Deinit();
|
||||||
|
Aurora::Exit::DeinitExit();
|
||||||
|
|
||||||
|
Aurora::RNG::Release(); // RNG and crypto should remain alive whilst IO work is ongoing.
|
||||||
|
// At this point, we should assume libtomcrypt and mbedtls wont be called
|
||||||
|
// The default gFastDevice shouldn't be hit for any reason
|
||||||
|
// ...we should be clear to start freeing those contexts and related system handles
|
||||||
|
|
||||||
|
// Exterminate reserve debug memory which may very well be in use
|
||||||
|
// So long as we assume aurora runtime users are dead, bye bye underlying (low-memory condition) heap
|
||||||
AuDebug::gReservePoolStart = 0;
|
AuDebug::gReservePoolStart = 0;
|
||||||
AuDebug::gReservePoolEnd = 0;
|
AuDebug::gReservePoolEnd = 0;
|
||||||
AuDebug::gReserveHeap.reset();
|
AuDebug::gReserveHeap.reset();
|
||||||
|
|
||||||
gRuntimeRunLevel = 5;
|
gRuntimeRunLevel = 5;
|
||||||
|
|
||||||
|
// TODO: forcefully terminate spawned threads
|
||||||
|
|
||||||
|
|
||||||
|
// TODO: debate terminate process for safety reasons i cant be bothered to explain (including AuDebug heap)
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace Aurora
|
namespace Aurora
|
||||||
|
Loading…
Reference in New Issue
Block a user