Sebastian Lackner : vcomp: Implement _vcomp_enter_critsect and _vcomp_leave_critsect.
Alexandre Julliard
julliard at wine.codeweavers.com
Fri Aug 7 10:57:42 CDT 2015
Module: wine
Branch: master
Commit: b0e4fd05e57100ce8d2275560eefb9a9d83ccef9
URL: http://source.winehq.org/git/wine.git/?a=commit;h=b0e4fd05e57100ce8d2275560eefb9a9d83ccef9
Author: Sebastian Lackner <sebastian at fds-team.de>
Date: Fri Aug 7 08:22:51 2015 +0200
vcomp: Implement _vcomp_enter_critsect and _vcomp_leave_critsect.
---
dlls/vcomp/main.c | 34 ++++++++++++++++++++++++++++++++++
dlls/vcomp/vcomp.spec | 4 ++--
dlls/vcomp100/vcomp100.spec | 4 ++--
dlls/vcomp110/vcomp110.spec | 4 ++--
dlls/vcomp90/vcomp90.spec | 4 ++--
5 files changed, 42 insertions(+), 8 deletions(-)
diff --git a/dlls/vcomp/main.c b/dlls/vcomp/main.c
index 1d9765f..10ac465 100644
--- a/dlls/vcomp/main.c
+++ b/dlls/vcomp/main.c
@@ -979,6 +979,40 @@ void WINAPIV _vcomp_fork(BOOL ifval, int nargs, void *wrapper, ...)
__ms_va_end(team_data.valist);
}
+void CDECL _vcomp_enter_critsect(CRITICAL_SECTION **critsect)
+{
+ TRACE("(%p)\n", critsect);
+
+ if (!*critsect)
+ {
+ CRITICAL_SECTION *new_critsect;
+ if (!(new_critsect = HeapAlloc(GetProcessHeap(), 0, sizeof(*new_critsect))))
+ {
+ ERR("could not allocate critical section\n");
+ ExitProcess(1);
+ }
+
+ InitializeCriticalSection(new_critsect);
+ new_critsect->DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": critsect");
+
+ if (interlocked_cmpxchg_ptr((void **)critsect, new_critsect, NULL) != NULL)
+ {
+ /* someone beat us to it */
+ new_critsect->DebugInfo->Spare[0] = 0;
+ DeleteCriticalSection(new_critsect);
+ HeapFree(GetProcessHeap(), 0, new_critsect);
+ }
+ }
+
+ EnterCriticalSection(*critsect);
+}
+
+void CDECL _vcomp_leave_critsect(CRITICAL_SECTION *critsect)
+{
+ TRACE("(%p)\n", critsect);
+ LeaveCriticalSection(critsect);
+}
+
BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved)
{
TRACE("(%p, %d, %p)\n", instance, reason, reserved);
diff --git a/dlls/vcomp/vcomp.spec b/dlls/vcomp/vcomp.spec
index 3167839..55b699f 100644
--- a/dlls/vcomp/vcomp.spec
+++ b/dlls/vcomp/vcomp.spec
@@ -53,7 +53,7 @@
@ cdecl _vcomp_barrier()
@ stub _vcomp_copyprivate_broadcast
@ stub _vcomp_copyprivate_receive
-@ stub _vcomp_enter_critsect
+@ cdecl _vcomp_enter_critsect(ptr)
@ stub _vcomp_flush
@ cdecl _vcomp_for_dynamic_init(long long long long long)
@ stub _vcomp_for_dynamic_init_i8
@@ -66,7 +66,7 @@
@ stub _vcomp_for_static_simple_init_i8
@ varargs _vcomp_fork(long long ptr)
@ stub _vcomp_get_thread_num
-@ stub _vcomp_leave_critsect
+@ cdecl _vcomp_leave_critsect(ptr)
@ stub _vcomp_master_barrier
@ cdecl _vcomp_master_begin()
@ cdecl _vcomp_master_end()
diff --git a/dlls/vcomp100/vcomp100.spec b/dlls/vcomp100/vcomp100.spec
index 38578b9..7bf6238 100644
--- a/dlls/vcomp100/vcomp100.spec
+++ b/dlls/vcomp100/vcomp100.spec
@@ -53,7 +53,7 @@
@ cdecl _vcomp_barrier() vcomp._vcomp_barrier
@ stub _vcomp_copyprivate_broadcast
@ stub _vcomp_copyprivate_receive
-@ stub _vcomp_enter_critsect
+@ cdecl _vcomp_enter_critsect(ptr) vcomp._vcomp_enter_critsect
@ stub _vcomp_flush
@ cdecl _vcomp_for_dynamic_init(long long long long long) vcomp._vcomp_for_dynamic_init
@ stub _vcomp_for_dynamic_init_i8
@@ -66,7 +66,7 @@
@ stub _vcomp_for_static_simple_init_i8
@ varargs _vcomp_fork(long long ptr) vcomp._vcomp_fork
@ stub _vcomp_get_thread_num
-@ stub _vcomp_leave_critsect
+@ cdecl _vcomp_leave_critsect(ptr) vcomp._vcomp_leave_critsect
@ stub _vcomp_master_barrier
@ cdecl _vcomp_master_begin() vcomp._vcomp_master_begin
@ cdecl _vcomp_master_end() vcomp._vcomp_master_end
diff --git a/dlls/vcomp110/vcomp110.spec b/dlls/vcomp110/vcomp110.spec
index ef8222f..c84e44c 100644
--- a/dlls/vcomp110/vcomp110.spec
+++ b/dlls/vcomp110/vcomp110.spec
@@ -54,7 +54,7 @@
@ cdecl _vcomp_barrier() vcomp._vcomp_barrier
@ stub _vcomp_copyprivate_broadcast
@ stub _vcomp_copyprivate_receive
-@ stub _vcomp_enter_critsect
+@ cdecl _vcomp_enter_critsect(ptr) vcomp._vcomp_enter_critsect
@ stub _vcomp_flush
@ cdecl _vcomp_for_dynamic_init(long long long long long) vcomp._vcomp_for_dynamic_init
@ stub _vcomp_for_dynamic_init_i8
@@ -67,7 +67,7 @@
@ stub _vcomp_for_static_simple_init_i8
@ varargs _vcomp_fork(long long ptr) vcomp._vcomp_fork
@ stub _vcomp_get_thread_num
-@ stub _vcomp_leave_critsect
+@ cdecl _vcomp_leave_critsect(ptr) vcomp._vcomp_leave_critsect
@ stub _vcomp_master_barrier
@ cdecl _vcomp_master_begin() vcomp._vcomp_master_begin
@ cdecl _vcomp_master_end() vcomp._vcomp_master_end
diff --git a/dlls/vcomp90/vcomp90.spec b/dlls/vcomp90/vcomp90.spec
index 38578b9..7bf6238 100644
--- a/dlls/vcomp90/vcomp90.spec
+++ b/dlls/vcomp90/vcomp90.spec
@@ -53,7 +53,7 @@
@ cdecl _vcomp_barrier() vcomp._vcomp_barrier
@ stub _vcomp_copyprivate_broadcast
@ stub _vcomp_copyprivate_receive
-@ stub _vcomp_enter_critsect
+@ cdecl _vcomp_enter_critsect(ptr) vcomp._vcomp_enter_critsect
@ stub _vcomp_flush
@ cdecl _vcomp_for_dynamic_init(long long long long long) vcomp._vcomp_for_dynamic_init
@ stub _vcomp_for_dynamic_init_i8
@@ -66,7 +66,7 @@
@ stub _vcomp_for_static_simple_init_i8
@ varargs _vcomp_fork(long long ptr) vcomp._vcomp_fork
@ stub _vcomp_get_thread_num
-@ stub _vcomp_leave_critsect
+@ cdecl _vcomp_leave_critsect(ptr) vcomp._vcomp_leave_critsect
@ stub _vcomp_master_barrier
@ cdecl _vcomp_master_begin() vcomp._vcomp_master_begin
@ cdecl _vcomp_master_end() vcomp._vcomp_master_end
More information about the wine-cvs
mailing list