diff src/thread/os2/SDL_systhread.c @ 1662:782fd950bd46 SDL-1.3

Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API. WARNING: None of the video drivers have been updated for the new API yet! The API is still under design and very fluid. The code is now run through a consistent indent format: indent -i4 -nut -nsc -br -ce The headers are being converted to automatically generate doxygen documentation.
author Sam Lantinga <slouken@libsdl.org>
date Sun, 28 May 2006 13:04:16 +0000
parents 9ebbbb4ae53b
children 4da1ee79c9af
line wrap: on
line diff
--- a/src/thread/os2/SDL_systhread.c	Sun May 21 17:27:13 2006 +0000
+++ b/src/thread/os2/SDL_systhread.c	Sun May 28 13:04:16 2006 +0000
@@ -34,75 +34,82 @@
 
 typedef struct ThreadStartParms
 {
-  void *args;
-  pfnSDL_CurrentEndThread pfnCurrentEndThread;
+    void *args;
+    pfnSDL_CurrentEndThread pfnCurrentEndThread;
 } tThreadStartParms, *pThreadStartParms;
 
-static void threadfunc(void *pparm)
+static void
+threadfunc (void *pparm)
 {
-  pThreadStartParms pThreadParms = pparm;
-  pfnSDL_CurrentEndThread pfnCurrentEndThread = NULL;
+    pThreadStartParms pThreadParms = pparm;
+    pfnSDL_CurrentEndThread pfnCurrentEndThread = NULL;
 
-  // Call the thread function!
-  SDL_RunThread(pThreadParms->args);
+    // Call the thread function!
+    SDL_RunThread (pThreadParms->args);
 
-  // Get the current endthread we have to use!
-  if (pThreadParms)
-  {
-    pfnCurrentEndThread = pThreadParms->pfnCurrentEndThread;
-    SDL_free(pThreadParms);
-  }
-  // Call endthread!
-  if (pfnCurrentEndThread)
-    (*pfnCurrentEndThread)();
+    // Get the current endthread we have to use!
+    if (pThreadParms) {
+        pfnCurrentEndThread = pThreadParms->pfnCurrentEndThread;
+        SDL_free (pThreadParms);
+    }
+    // Call endthread!
+    if (pfnCurrentEndThread)
+        (*pfnCurrentEndThread) ();
 }
 
-int SDL_SYS_CreateThread(SDL_Thread *thread, void *args, pfnSDL_CurrentBeginThread pfnBeginThread, pfnSDL_CurrentEndThread pfnEndThread)
+int
+SDL_SYS_CreateThread (SDL_Thread * thread, void *args,
+                      pfnSDL_CurrentBeginThread pfnBeginThread,
+                      pfnSDL_CurrentEndThread pfnEndThread)
 {
-  pThreadStartParms pThreadParms = SDL_malloc(sizeof(tThreadStartParms));
-  if (!pThreadParms)
-  {
-    SDL_SetError("Not enough memory to create thread");
-    return(-1);
-  }
-
-  // Save the function which we will have to call to clear the RTL of calling app!
-  pThreadParms->pfnCurrentEndThread = pfnEndThread;
-  // Also save the real parameters we have to pass to thread function
-  pThreadParms->args = args;
-  // Start the thread using the runtime library of calling app!
-  thread->threadid = thread->handle = (*pfnBeginThread)(threadfunc, NULL, 512*1024, pThreadParms);
-  if ((int)thread->threadid <= 0)
-  {
-    SDL_SetError("Not enough resources to create thread");
-    return(-1);
-  }
-  return(0);
+    pThreadStartParms pThreadParms = SDL_malloc (sizeof (tThreadStartParms));
+    if (!pThreadParms) {
+        SDL_SetError ("Not enough memory to create thread");
+        return (-1);
+    }
+    // Save the function which we will have to call to clear the RTL of calling app!
+    pThreadParms->pfnCurrentEndThread = pfnEndThread;
+    // Also save the real parameters we have to pass to thread function
+    pThreadParms->args = args;
+    // Start the thread using the runtime library of calling app!
+    thread->threadid = thread->handle =
+        (*pfnBeginThread) (threadfunc, NULL, 512 * 1024, pThreadParms);
+    if ((int) thread->threadid <= 0) {
+        SDL_SetError ("Not enough resources to create thread");
+        return (-1);
+    }
+    return (0);
 }
 
-void SDL_SYS_SetupThread(void)
+void
+SDL_SYS_SetupThread (void)
 {
-  return;
+    return;
 }
 
-DECLSPEC Uint32 SDLCALL SDL_ThreadID(void)
+DECLSPEC Uint32 SDLCALL
+SDL_ThreadID (void)
 {
-  PTIB tib;
-  DosGetInfoBlocks(&tib, NULL);
-  return((Uint32) (tib->tib_ptib2->tib2_ultid));
+    PTIB tib;
+    DosGetInfoBlocks (&tib, NULL);
+    return ((Uint32) (tib->tib_ptib2->tib2_ultid));
 }
 
-void SDL_SYS_WaitThread(SDL_Thread *thread)
+void
+SDL_SYS_WaitThread (SDL_Thread * thread)
 {
-  TID tid = thread->handle;
-  DosWaitThread(&tid, DCWW_WAIT);
+    TID tid = thread->handle;
+    DosWaitThread (&tid, DCWW_WAIT);
 }
 
 /* WARNING: This function is really a last resort.
  * Threads should be signaled and then exit by themselves.
  * TerminateThread() doesn't perform stack and DLL cleanup.
  */
-void SDL_SYS_KillThread(SDL_Thread *thread)
+void
+SDL_SYS_KillThread (SDL_Thread * thread)
 {
-  DosKillThread(thread->handle);
+    DosKillThread (thread->handle);
 }
+
+/* vi: set ts=4 sw=4 expandtab: */