port from 2.0.12 to 2.0.13 / current SDL-hg repository. - video: VideoBootStrap->available() is gone. - thread: all important SDL_CreateThread internal data now put into struct SDL_Thread: changes to SDL_SYS_CreateThread().
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140
diff --git a/src/thread/os2/SDL_systhread.c b/src/thread/os2/SDL_systhread.c
index 64d5d6f..909ae01 100644
--- a/src/thread/os2/SDL_systhread.c
+++ b/src/thread/os2/SDL_systhread.c
@@ -40,57 +40,39 @@
#include <process.h>
-typedef struct ThreadStartParms {
- void *args;
- pfnSDL_CurrentEndThread pfnCurrentEndThread;
-} tThreadStartParms, *pThreadStartParms;
-
static void RunThread(void *data)
{
- pThreadStartParms pThreadParms = (pThreadStartParms) data;
- pfnSDL_CurrentEndThread pfnEndThread = pThreadParms->pfnCurrentEndThread;
- void *args = pThreadParms->args;
-
- SDL_free( pThreadParms );
+ SDL_Thread *thread = (SDL_Thread *) data;
+ pfnSDL_CurrentEndThread pfnEndThread = (pfnSDL_CurrentEndThread) thread->endfunc;
if ( ppSDLTLSData != NULL )
*ppSDLTLSData = NULL;
- SDL_RunThread( args );
+ SDL_RunThread( thread );
if ( pfnEndThread != NULL )
pfnEndThread();
}
-
-
int
-SDL_SYS_CreateThread(SDL_Thread * thread, void *args,
+SDL_SYS_CreateThread(SDL_Thread * thread,
pfnSDL_CurrentBeginThread pfnBeginThread,
pfnSDL_CurrentEndThread pfnEndThread)
{
- pThreadStartParms pThreadParms = SDL_malloc( sizeof(tThreadStartParms) );
-
- if ( pThreadParms == NULL )
- return SDL_OutOfMemory();
-
if (thread->stacksize == 0)
thread->stacksize = 65536;
- // Also save the real parameters we have to pass to thread function
- pThreadParms->args = args;
-
if (pfnBeginThread) {
// Save the function which we will have to call to clear the RTL of calling app!
- pThreadParms->pfnCurrentEndThread = pfnEndThread;
+ thread->endfunc = pfnEndThread;
// Start the thread using the runtime library of calling app!
thread->handle = (SYS_ThreadHandle)
- pfnBeginThread( RunThread, NULL, thread->stacksize, pThreadParms );
+ pfnBeginThread( RunThread, NULL, thread->stacksize, thread );
}
else {
- pThreadParms->pfnCurrentEndThread = _endthread;
+ thread->endfunc = _endthread;
thread->handle = (SYS_ThreadHandle)
- _beginthread( RunThread, NULL, thread->stacksize, pThreadParms );
+ _beginthread( RunThread, NULL, thread->stacksize, thread );
}
if ( thread->handle == -1 )
diff --git a/src/video/os2/SDL_os2video.c b/src/video/os2/SDL_os2video.c
index 9266152..662c67f 100644
--- a/src/video/os2/SDL_os2video.c
+++ b/src/video/os2/SDL_os2video.c
@@ -1599,7 +1599,7 @@ static int OS2_VideoInit(_THIS)
stSDLDisplayMode.driverdata = pDisplayData;
}
- SDL_AddVideoDisplay( &stSDLDisplay );
+ SDL_AddVideoDisplay( &stSDLDisplay, SDL_FALSE );
}
OS2_InitMouse( _this, pVData->hab );
@@ -1705,7 +1705,7 @@ static SDL_VideoDevice *OS2_CreateDevice(int devindex)
if (!device)
{
SDL_OutOfMemory();
- return (0);
+ return NULL;
}
/* Set the function pointers */
@@ -1753,21 +1753,22 @@ static SDL_VideoDevice *OS2_CreateDevice(int devindex)
return device;
}
-
-// Output video system availability checking.
-
-static int OS2DIVE_Available(void)
+static SDL_VideoDevice *OS2DIVE_CreateDevice(int devindex)
{
VIDEOOUTPUTINFO stVOInfo;
-
- return voDive.QueryInfo( &stVOInfo );
+ if (!voDive.QueryInfo(&stVOInfo)) {
+ return NULL;
+ }
+ return OS2_CreateDevice(devindex);
}
-static int OS2VMAN_Available(void)
+static SDL_VideoDevice *OS2VMAN_CreateDevice(int devindex)
{
VIDEOOUTPUTINFO stVOInfo;
-
- return voVMan.QueryInfo( &stVOInfo );
+ if (!voVMan.QueryInfo(&stVOInfo)) {
+ return NULL;
+ }
+ return OS2_CreateDevice(devindex);
}
@@ -1777,13 +1778,13 @@ static int OS2VMAN_Available(void)
VideoBootStrap OS2DIVE_bootstrap =
{
OS2DRIVER_NAME_DIVE, "OS/2 video driver",
- OS2DIVE_Available, OS2_CreateDevice
+ OS2DIVE_CreateDevice
};
VideoBootStrap OS2VMAN_bootstrap =
{
OS2DRIVER_NAME_VMAN, "OS/2 video driver",
- OS2VMAN_Available, OS2_CreateDevice
+ OS2VMAN_CreateDevice
};
#endif /* SDL_VIDEO_DRIVER_OS2 */