diff options
Diffstat (limited to 'src/vm/listlock.inl')
-rw-r--r-- | src/vm/listlock.inl | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/src/vm/listlock.inl b/src/vm/listlock.inl new file mode 100644 index 0000000000..17e383edd7 --- /dev/null +++ b/src/vm/listlock.inl @@ -0,0 +1,51 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. +// =========================================================================== +// + +// +// File: ListLock.inl +// +// =========================================================================== +// This file decribes the list lock and deadlock aware list lock functions +// that are inlined but can't go in the header. +// =========================================================================== +#ifndef LISTLOCK_INL +#define LISTLOCK_INL + +#include "listlock.h" +#include "dbginterface.h" +// Must own the lock before calling this or is ok if the debugger has +// all threads stopped + +inline ListLockEntry *ListLock::Find(void *pData) +{ + CONTRACTL + { + NOTHROW; + GC_NOTRIGGER; + PRECONDITION(CheckPointer(this)); +#ifdef DEBUGGING_SUPPORTED + PRECONDITION(m_Crst.OwnedByCurrentThread() || + CORDebuggerAttached() && g_pDebugInterface->IsStopped()); +#else + PRECONDITION(m_Crst.OwnedByCurrentThread()); +#endif // DEBUGGING_SUPPORTED + + } + CONTRACTL_END; + + ListLockEntry *pSearch; + + for (pSearch = m_pHead; pSearch != NULL; pSearch = pSearch->m_pNext) + { + if (pSearch->m_pData == pData) + return pSearch; + } + + return NULL; +} + + +#endif // LISTLOCK_I |