[*] Disable telemetry reporting after runtime shutdown to prevent null exceptions from being reported under TLS. Fixes deadlock and a crash.

This commit is contained in:
Reece Wilson 2022-12-21 23:37:41 +00:00
parent a1e77a471b
commit 15c7df1480
3 changed files with 19 additions and 0 deletions

View File

@ -15,6 +15,7 @@ namespace Aurora::Grug
{
static AuList<Arrow *> gReservedArrows; // stacks are slower than vectors under msvc, 'twas a qst bottleneck
static AuThreadPrimitives::SpinLock gSpinLock;
static bool gDisableGrugMessages {};
void SignalSafeSleepLockYield(AuThreadPrimitives::SpinLock &lock)
{
@ -30,6 +31,11 @@ namespace Aurora::Grug
void HurlArrow(Arrow *pArrow, GrugReport_f pCallback, GrugReport_f pCallbackRunaway)
{
if (gDisableGrugMessages)
{
return;
}
pArrow->pCallback = pCallback;
pArrow->pCallbackRunaway = pCallbackRunaway;
@ -54,6 +60,11 @@ namespace Aurora::Grug
void ArrowWait(Arrow *arrow)
{
if (gDisableGrugMessages)
{
return;
}
AU_LOCK_GUARD(arrow->spinSemaphore);
}
@ -131,4 +142,9 @@ namespace Aurora::Grug
{
gReservedArrows.reserve(20);
}
void DeinitArrows()
{
gDisableGrugMessages = true;
}
}

View File

@ -28,4 +28,5 @@ namespace Aurora::Grug
void HurlFatalEvent(Arrow *pArrow);
void DequeueOneArrow();
void DeinitArrows();
}

View File

@ -156,6 +156,8 @@ namespace Aurora::Grug
gMutex.reset();
gCondVar.reset();
gArrows.reset();
DeinitArrows();
}
void NotifyGrugOfTelemetry()