bool CrstStatic::OwnedByCurrentThread() { #ifndef DACCESS_COMPILE return m_uiOwnerId == PalGetCurrentThreadId(); #else return false; #endif }
// static void CrstStatic::Enter(CrstStatic *pCrst) { #ifndef DACCESS_COMPILE PalEnterCriticalSection(&pCrst->m_sCritSec); #if defined(_DEBUG) pCrst->m_uiOwnerId = PalGetCurrentThreadId(); #endif // _DEBUG #else UNREFERENCED_PARAMETER(pCrst); #endif // !DACCESS_COMPILE }
void ThreadStressLog::Activate (Thread * pThread) { _ASSERTE(pThread != NULL); //there is no need to zero buffers because we could handle garbage contents threadId = PalGetCurrentThreadId (); isDead = FALSE; curWriteChunk = chunkListTail; curPtr = (StressMsg *)curWriteChunk->EndPtr (); writeHasWrapped = FALSE; this->pThread = pThread; ASSERT(pThread->GetPalThreadId() == threadId); }
void ThreadStressLog::LogMsg ( UInt32 facility, int cArgs, const char* format, va_list Args) { // Asserts in this function cause infinite loops in the asserting mechanism. // Just use debug breaks instead. ASSERT( cArgs >= 0 && cArgs <= StressMsg::maxArgCnt ); size_t offs = ((size_t)format - StressLog::theLog.moduleOffset); ASSERT(offs < StressMsg::maxOffset); if (offs >= StressMsg::maxOffset) { // Set it to this string instead. offs = #ifdef _DEBUG (size_t)"<BUG: StressLog format string beyond maxOffset>"; #else // _DEBUG 0; // a 0 offset is ignored by StressLog::Dump #endif // _DEBUG else } // Get next available slot StressMsg* msg = AdvanceWrite(cArgs); msg->timeStamp = getTimeStamp(); msg->facility = facility; msg->formatOffset = offs; msg->numberOfArgs = cArgs; for ( int i = 0; i < cArgs; ++i ) { void* data = va_arg(Args, void*); msg->args[i] = data; } ASSERT(IsValid() && threadId == PalGetCurrentThreadId ()); }
bool EEThreadId::IsSameThread() { return PalGetCurrentThreadId() == m_uiId; }