mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-09-06 11:28:15 +00:00
Fixed OS/2 build
This commit is contained in:
10
src/SDL.c
10
src/SDL.c
@@ -29,9 +29,6 @@
|
|||||||
#endif
|
#endif
|
||||||
#if defined(__OS2__)
|
#if defined(__OS2__)
|
||||||
#include "core/os2/SDL_os2.h"
|
#include "core/os2/SDL_os2.h"
|
||||||
#ifdef SDL_THREAD_OS2
|
|
||||||
#include "thread/os2/SDL_systls_c.h"
|
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* this checks for HAVE_DBUS_DBUS_H internally. */
|
/* this checks for HAVE_DBUS_DBUS_H internally. */
|
||||||
@@ -200,10 +197,6 @@ int SDL_InitSubSystem(Uint32 flags)
|
|||||||
SDL_DBus_Init();
|
SDL_DBus_Init();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef SDL_THREAD_OS2
|
|
||||||
SDL_OS2TLSAlloc(); /* thread/os2/SDL_systls.c */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef SDL_VIDEO_DRIVER_WINDOWS
|
#ifdef SDL_VIDEO_DRIVER_WINDOWS
|
||||||
if (flags & (SDL_INIT_HAPTIC | SDL_INIT_JOYSTICK)) {
|
if (flags & (SDL_INIT_HAPTIC | SDL_INIT_JOYSTICK)) {
|
||||||
if (SDL_HelperWindowCreate() < 0) {
|
if (SDL_HelperWindowCreate() < 0) {
|
||||||
@@ -380,9 +373,6 @@ int SDL_Init(Uint32 flags)
|
|||||||
void SDL_QuitSubSystem(Uint32 flags)
|
void SDL_QuitSubSystem(Uint32 flags)
|
||||||
{
|
{
|
||||||
#if defined(__OS2__)
|
#if defined(__OS2__)
|
||||||
#ifdef SDL_THREAD_OS2
|
|
||||||
SDL_OS2TLSFree(); /* thread/os2/SDL_systls.c */
|
|
||||||
#endif
|
|
||||||
SDL_OS2Quit();
|
SDL_OS2Quit();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -34,45 +34,22 @@
|
|||||||
|
|
||||||
SDL_TLSData **ppSDLTLSData = NULL;
|
SDL_TLSData **ppSDLTLSData = NULL;
|
||||||
|
|
||||||
static ULONG cTLSAlloc = 0;
|
void SDL_SYS_InitTLSData(void)
|
||||||
|
|
||||||
/* SDL_OS2TLSAlloc() called from SDL_InitSubSystem() */
|
|
||||||
void SDL_OS2TLSAlloc(void)
|
|
||||||
{
|
{
|
||||||
ULONG ulRC;
|
ULONG ulRC;
|
||||||
|
|
||||||
if (cTLSAlloc == 0 || !ppSDLTLSData) {
|
if (!ppSDLTLSData) {
|
||||||
/* First call - allocate the thread local memory (1 DWORD) */
|
/* Allocate the thread local memory (1 DWORD) */
|
||||||
ulRC = DosAllocThreadLocalMemory(1, (PULONG *)&ppSDLTLSData);
|
ulRC = DosAllocThreadLocalMemory(1, (PULONG *)&ppSDLTLSData);
|
||||||
if (ulRC != NO_ERROR) {
|
if (ulRC != NO_ERROR) {
|
||||||
debug_os2("DosAllocThreadLocalMemory() failed, rc = %u", ulRC);
|
debug_os2("DosAllocThreadLocalMemory() failed, rc = %u", ulRC);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cTLSAlloc++;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* SDL_OS2TLSFree() called from SDL_QuitSubSystem() */
|
|
||||||
void SDL_OS2TLSFree(void)
|
|
||||||
{
|
|
||||||
ULONG ulRC;
|
|
||||||
|
|
||||||
if (cTLSAlloc != 0)
|
|
||||||
cTLSAlloc--;
|
|
||||||
|
|
||||||
if (cTLSAlloc == 0 && ppSDLTLSData) {
|
|
||||||
/* Last call - free the thread local memory */
|
|
||||||
ulRC = DosFreeThreadLocalMemory((PULONG)ppSDLTLSData);
|
|
||||||
if (ulRC != NO_ERROR) {
|
|
||||||
debug_os2("DosFreeThreadLocalMemory() failed, rc = %u", ulRC);
|
|
||||||
} else {
|
|
||||||
ppSDLTLSData = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_TLSData *SDL_SYS_GetTLSData(void)
|
SDL_TLSData *SDL_SYS_GetTLSData(void)
|
||||||
{
|
{
|
||||||
return (!ppSDLTLSData)? NULL : *ppSDLTLSData;
|
return ppSDLTLSData ? *ppSDLTLSData : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SDL_SYS_SetTLSData(SDL_TLSData *data)
|
int SDL_SYS_SetTLSData(SDL_TLSData *data)
|
||||||
@@ -84,6 +61,21 @@ int SDL_SYS_SetTLSData(SDL_TLSData *data)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SDL_SYS_QuitTLSData(void)
|
||||||
|
{
|
||||||
|
ULONG ulRC;
|
||||||
|
|
||||||
|
if (ppSDLTLSData) {
|
||||||
|
/* Free the thread local memory */
|
||||||
|
ulRC = DosFreeThreadLocalMemory((PULONG)ppSDLTLSData);
|
||||||
|
if (ulRC != NO_ERROR) {
|
||||||
|
debug_os2("DosFreeThreadLocalMemory() failed, rc = %u", ulRC);
|
||||||
|
} else {
|
||||||
|
ppSDLTLSData = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* SDL_THREAD_OS2 */
|
#endif /* SDL_THREAD_OS2 */
|
||||||
|
|
||||||
/* vi: set ts=4 sw=4 expandtab: */
|
/* vi: set ts=4 sw=4 expandtab: */
|
||||||
|
@@ -27,12 +27,4 @@
|
|||||||
|
|
||||||
extern SDL_TLSData **ppSDLTLSData;
|
extern SDL_TLSData **ppSDLTLSData;
|
||||||
|
|
||||||
/* SDL_OS2TLSAlloc() called from SDL_InitSubSystem() */
|
|
||||||
void SDL_OS2TLSAlloc(void);
|
|
||||||
|
|
||||||
/* SDL_OS2TLSFree() called from SDL_QuitSubSystem() */
|
|
||||||
void SDL_OS2TLSFree(void);
|
|
||||||
|
|
||||||
#endif /* SDL_THREAD_OS2 */
|
#endif /* SDL_THREAD_OS2 */
|
||||||
|
|
||||||
/* vi: set ts=4 sw=4 expandtab: */
|
|
||||||
|
Reference in New Issue
Block a user