From efbd47f4bcb40b3caccb654f07854abc761ab64b Mon Sep 17 00:00:00 2001 From: dhewg Date: Tue, 20 Dec 2011 18:46:08 +0100 Subject: [PATCH] Port critical sections and events to SDL Use SDL mutexes and conditions. One new critical section CRITICAL_SECTION_SYS for events. --- CMakeLists.txt | 3 +++ sys/sys_public.h | 8 ++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8f86cb4..b3ebf15 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -614,6 +614,7 @@ set(src_sys_dedicated sys/linux/dedicated.cpp) if (APPLE) set(src_sys_base + sys/threads.cpp sys/sys_local.cpp sys/posix/posix_net.cpp sys/posix/posix_signal.cpp @@ -635,6 +636,7 @@ if (APPLE) ) elseif (WIN32) set(src_sys_base + sys/threads.cpp sys/sys_local.cpp sys/win32/win_cpu.cpp # sys/win32/win_gamma.cpp @@ -654,6 +656,7 @@ elseif (WIN32) ) else() set(src_sys_base + sys/threads.cpp sys/sys_local.cpp sys/posix/posix_net.cpp sys/posix/posix_signal.cpp diff --git a/sys/sys_public.h b/sys/sys_public.h index 6813bae..f583ca2 100644 --- a/sys/sys_public.h +++ b/sys/sys_public.h @@ -383,13 +383,17 @@ void Sys_DestroyThread( xthreadInfo& info ); // sets threadHandle back to 0 // if index != NULL, set the index in g_threads array (use -1 for "main" thread) const char * Sys_GetThreadName( int *index = 0 ); -const int MAX_CRITICAL_SECTIONS = 4; +extern void Sys_InitThreads(); +extern void Sys_ShutdownThreads(); + +const int MAX_CRITICAL_SECTIONS = 5; enum { CRITICAL_SECTION_ZERO = 0, CRITICAL_SECTION_ONE, CRITICAL_SECTION_TWO, - CRITICAL_SECTION_THREE + CRITICAL_SECTION_THREE, + CRITICAL_SECTION_SYS }; void Sys_EnterCriticalSection( int index = CRITICAL_SECTION_ZERO );