diff --git a/Source/Threading/Threads/AuOSThread.cpp b/Source/Threading/Threads/AuOSThread.cpp index 29c21f3d..2a471b0d 100644 --- a/Source/Threading/Threads/AuOSThread.cpp +++ b/Source/Threading/Threads/AuOSThread.cpp @@ -309,6 +309,8 @@ namespace Aurora::Threading::Threads bool OSThread::Run() { + AU_DEBUG_MEMCRUNCH; + if (!this->terminated_) { SysPanic("::Run called on system thread"); @@ -320,15 +322,16 @@ namespace Aurora::Threading::Threads } this->terminated_->Reset(); + auto copy = this->info_.callbacks; return ExecuteNewOSContext([=]() { try { // this functional backends are being deprecated - if (this->info_.callbacks) + if (copy) { - this->info_.callbacks->OnEntry(this); + copy->OnEntry(this); } } catch (...) @@ -598,6 +601,8 @@ namespace Aurora::Threading::Threads void OSThread::_ThreadEP() { + AU_DEBUG_MEMCRUNCH; + // Poke TLS reference thread entity // TODO: we need an internal OSThread *TryPokeTLSThread() auto osThread = static_cast(GetThread()); @@ -629,6 +634,7 @@ namespace Aurora::Threading::Threads if (auto task = task_) { this->epExecEvent->Set(); + AU_DEBUG_REVERSE_MEMCRUNCH; task(); } }