2019-05-14 15:00:59 -07:00
|
|
|
From 7ab8094fbbc9adb4a5406fd9a780ab5542a5a3e4 Mon Sep 17 00:00:00 2001
|
2017-08-05 21:14:42 -07:00
|
|
|
From: Sebastian Lackner <sebastian@fds-team.de>
|
|
|
|
Date: Sat, 5 Aug 2017 03:38:38 +0200
|
2019-05-14 15:00:59 -07:00
|
|
|
Subject: [PATCH] ntdll: Add inline versions of RtlEnterCriticalSection /
|
2017-08-05 21:14:42 -07:00
|
|
|
RtlLeaveCriticalSections.
|
|
|
|
|
|
|
|
---
|
|
|
|
dlls/ntdll/ntdll_misc.h | 38 ++++++++++++++++++++++++++++++++++++++
|
|
|
|
1 file changed, 38 insertions(+)
|
|
|
|
|
|
|
|
diff --git a/dlls/ntdll/ntdll_misc.h b/dlls/ntdll/ntdll_misc.h
|
2019-05-14 15:00:59 -07:00
|
|
|
index 84866721a07..303cad1764a 100644
|
2017-08-05 21:14:42 -07:00
|
|
|
--- a/dlls/ntdll/ntdll_misc.h
|
|
|
|
+++ b/dlls/ntdll/ntdll_misc.h
|
|
|
|
@@ -27,6 +27,7 @@
|
|
|
|
#include "windef.h"
|
|
|
|
#include "winnt.h"
|
|
|
|
#include "winternl.h"
|
|
|
|
+#include "wine/debug.h"
|
|
|
|
#include "wine/server.h"
|
2019-05-14 15:00:59 -07:00
|
|
|
#include "wine/asm.h"
|
2017-08-05 21:14:42 -07:00
|
|
|
|
2019-05-14 15:00:59 -07:00
|
|
|
@@ -214,6 +215,43 @@ extern int ntdll_wcstoumbs(DWORD flags, const WCHAR* src, int srclen, char* dst,
|
2017-08-05 21:14:42 -07:00
|
|
|
extern int CDECL NTDLL__vsnprintf( char *str, SIZE_T len, const char *format, __ms_va_list args ) DECLSPEC_HIDDEN;
|
|
|
|
extern int CDECL NTDLL__vsnwprintf( WCHAR *str, SIZE_T len, const WCHAR *format, __ms_va_list args ) DECLSPEC_HIDDEN;
|
|
|
|
|
|
|
|
+#ifdef __WINE_WINE_PORT_H
|
|
|
|
+
|
|
|
|
+/* inline version of RtlEnterCriticalSection */
|
|
|
|
+static inline void enter_critical_section( RTL_CRITICAL_SECTION *crit )
|
|
|
|
+{
|
|
|
|
+ if (interlocked_inc( &crit->LockCount ))
|
|
|
|
+ {
|
|
|
|
+ if (crit->OwningThread == ULongToHandle(GetCurrentThreadId()))
|
|
|
|
+ {
|
|
|
|
+ crit->RecursionCount++;
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ RtlpWaitForCriticalSection( crit );
|
|
|
|
+ }
|
|
|
|
+ crit->OwningThread = ULongToHandle(GetCurrentThreadId());
|
|
|
|
+ crit->RecursionCount = 1;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+/* inline version of RtlLeaveCriticalSection */
|
|
|
|
+static inline void leave_critical_section( RTL_CRITICAL_SECTION *crit )
|
|
|
|
+{
|
|
|
|
+ WINE_DECLARE_DEBUG_CHANNEL(ntdll);
|
|
|
|
+ if (--crit->RecursionCount)
|
|
|
|
+ {
|
|
|
|
+ if (crit->RecursionCount > 0) interlocked_dec( &crit->LockCount );
|
|
|
|
+ else ERR_(ntdll)( "section %p is not acquired\n", crit );
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ crit->OwningThread = 0;
|
|
|
|
+ if (interlocked_dec( &crit->LockCount ) >= 0)
|
|
|
|
+ RtlpUnWaitCriticalSection( crit );
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+#endif /* __WINE_WINE_PORT_H */
|
|
|
|
+
|
|
|
|
/* load order */
|
|
|
|
|
|
|
|
enum loadorder
|
|
|
|
--
|
2019-05-14 15:00:59 -07:00
|
|
|
2.20.1
|
2017-08-05 21:14:42 -07:00
|
|
|
|