Port critical sections and events to SDL

Use SDL mutexes and conditions.
One new critical section CRITICAL_SECTION_SYS for events.
This commit is contained in:
dhewg 2011-12-20 18:46:08 +01:00 committed by Daniel Gibson
parent f41d2347b1
commit efbd47f4bc
2 changed files with 9 additions and 2 deletions

View file

@ -614,6 +614,7 @@ set(src_sys_dedicated sys/linux/dedicated.cpp)
if (APPLE) if (APPLE)
set(src_sys_base set(src_sys_base
sys/threads.cpp
sys/sys_local.cpp sys/sys_local.cpp
sys/posix/posix_net.cpp sys/posix/posix_net.cpp
sys/posix/posix_signal.cpp sys/posix/posix_signal.cpp
@ -635,6 +636,7 @@ if (APPLE)
) )
elseif (WIN32) elseif (WIN32)
set(src_sys_base set(src_sys_base
sys/threads.cpp
sys/sys_local.cpp sys/sys_local.cpp
sys/win32/win_cpu.cpp sys/win32/win_cpu.cpp
# sys/win32/win_gamma.cpp # sys/win32/win_gamma.cpp
@ -654,6 +656,7 @@ elseif (WIN32)
) )
else() else()
set(src_sys_base set(src_sys_base
sys/threads.cpp
sys/sys_local.cpp sys/sys_local.cpp
sys/posix/posix_net.cpp sys/posix/posix_net.cpp
sys/posix/posix_signal.cpp sys/posix/posix_signal.cpp

View file

@ -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) // if index != NULL, set the index in g_threads array (use -1 for "main" thread)
const char * Sys_GetThreadName( int *index = 0 ); 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 { enum {
CRITICAL_SECTION_ZERO = 0, CRITICAL_SECTION_ZERO = 0,
CRITICAL_SECTION_ONE, CRITICAL_SECTION_ONE,
CRITICAL_SECTION_TWO, CRITICAL_SECTION_TWO,
CRITICAL_SECTION_THREE CRITICAL_SECTION_THREE,
CRITICAL_SECTION_SYS
}; };
void Sys_EnterCriticalSection( int index = CRITICAL_SECTION_ZERO ); void Sys_EnterCriticalSection( int index = CRITICAL_SECTION_ZERO );