Sebastian Lackner : vcomp: Use RtlIsCriticalSectionLockedByThread to check lock owner.

Alexandre Julliard julliard at wine.codeweavers.com
Mon Oct 12 09:51:13 CDT 2015


Module: wine
Branch: master
Commit: 2964c2b34bfcedad045a7800b7d15aef6433fe21
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=2964c2b34bfcedad045a7800b7d15aef6433fe21

Author: Sebastian Lackner <sebastian at fds-team.de>
Date:   Sat Oct 10 05:40:56 2015 +0200

vcomp: Use RtlIsCriticalSectionLockedByThread to check lock owner.

Signed-off-by: Sebastian Lackner <sebastian at fds-team.de>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/vcomp/main.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/dlls/vcomp/main.c b/dlls/vcomp/main.c
index 5aa0343..12fd2a5 100644
--- a/dlls/vcomp/main.c
+++ b/dlls/vcomp/main.c
@@ -29,6 +29,7 @@
 
 #include "windef.h"
 #include "winbase.h"
+#include "winternl.h"
 #include "wine/debug.h"
 #include "wine/list.h"
 
@@ -1051,12 +1052,6 @@ static void destroy_critsect(CRITICAL_SECTION *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)
 {
     TRACE("(%p)\n", lock);
@@ -1073,7 +1068,7 @@ void CDECL omp_set_lock(omp_lock_t *lock)
 {
     TRACE("(%p)\n", lock);
 
-    if (critsect_is_locked(*lock))
+    if (RtlIsCriticalSectionLockedByThread(*lock))
     {
         ERR("omp_set_lock called while holding lock %p\n", *lock);
         ExitProcess(1);
@@ -1092,7 +1087,7 @@ int CDECL omp_test_lock(omp_lock_t *lock)
 {
     TRACE("(%p)\n", lock);
 
-    if (critsect_is_locked(*lock))
+    if (RtlIsCriticalSectionLockedByThread(*lock))
         return 0;
 
     return TryEnterCriticalSection(*lock);




More information about the wine-cvs mailing list