vcomp: Implement _vcomp_enter_critsect and _vcomp_leave_critsect.

This commit is contained in:
Sebastian Lackner 2015-08-07 08:22:51 +02:00 committed by Alexandre Julliard
parent 89b383740c
commit b0e4fd05e5
5 changed files with 42 additions and 8 deletions

View File

@ -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);

View File

@ -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()

View File

@ -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

View File

@ -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

View File

@ -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