Commit 2964c2b3 authored by Sebastian Lackner's avatar Sebastian Lackner Committed by Alexandre Julliard

vcomp: Use RtlIsCriticalSectionLockedByThread to check lock owner.

parent 240cf962
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#include "windef.h" #include "windef.h"
#include "winbase.h" #include "winbase.h"
#include "winternl.h"
#include "wine/debug.h" #include "wine/debug.h"
#include "wine/list.h" #include "wine/list.h"
...@@ -1051,12 +1052,6 @@ static void destroy_critsect(CRITICAL_SECTION *critsect) ...@@ -1051,12 +1052,6 @@ static void destroy_critsect(CRITICAL_SECTION *critsect)
HeapFree(GetProcessHeap(), 0, critsect); HeapFree(GetProcessHeap(), 0, critsect);
} }
static BOOL critsect_is_locked(CRITICAL_SECTION *critsect)
{
return critsect->OwningThread == ULongToHandle(GetCurrentThreadId()) &&
critsect->RecursionCount;
}
void CDECL omp_init_lock(omp_lock_t *lock) void CDECL omp_init_lock(omp_lock_t *lock)
{ {
TRACE("(%p)\n", lock); TRACE("(%p)\n", lock);
...@@ -1073,7 +1068,7 @@ void CDECL omp_set_lock(omp_lock_t *lock) ...@@ -1073,7 +1068,7 @@ void CDECL omp_set_lock(omp_lock_t *lock)
{ {
TRACE("(%p)\n", lock); TRACE("(%p)\n", lock);
if (critsect_is_locked(*lock)) if (RtlIsCriticalSectionLockedByThread(*lock))
{ {
ERR("omp_set_lock called while holding lock %p\n", *lock); ERR("omp_set_lock called while holding lock %p\n", *lock);
ExitProcess(1); ExitProcess(1);
...@@ -1092,7 +1087,7 @@ int CDECL omp_test_lock(omp_lock_t *lock) ...@@ -1092,7 +1087,7 @@ int CDECL omp_test_lock(omp_lock_t *lock)
{ {
TRACE("(%p)\n", lock); TRACE("(%p)\n", lock);
if (critsect_is_locked(*lock)) if (RtlIsCriticalSectionLockedByThread(*lock))
return 0; return 0;
return TryEnterCriticalSection(*lock); return TryEnterCriticalSection(*lock);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment