Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Pth threading bug fix
  • Loading branch information
slouken committed Jun 10, 2002
1 parent 62c2a08 commit 89785c6
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
10 changes: 10 additions & 0 deletions src/SDL.c
Expand Up @@ -150,6 +150,12 @@ int SDL_InitSubSystem(Uint32 flags)

int SDL_Init(Uint32 flags)
{
#if !defined(DISABLE_THREADS) && defined(ENABLE_PTH)
if (!pth_init()) {
return -1;
}
#endif

/* Clear the error message */
SDL_ClearError();

Expand Down Expand Up @@ -223,6 +229,10 @@ void SDL_Quit(void)

/* Uninstall any parachute signal handlers */
SDL_UninstallParachute();

#if !defined(DISABLE_THREADS) && defined(ENABLE_PTH)
pth_kill();
#endif
}

/* Return the library version number */
Expand Down
10 changes: 0 additions & 10 deletions src/thread/SDL_thread.c
Expand Up @@ -52,12 +52,6 @@ int SDL_ThreadsInit(void)
{
int retval;

#ifdef ENABLE_PTH
if (!pth_init()) {
return -1;
}
#endif

retval = 0;
/* Set the thread lock creation flag so that we can reuse an
existing lock on the system - since this mutex never gets
Expand Down Expand Up @@ -86,10 +80,6 @@ void SDL_ThreadsQuit()
if ( mutex != NULL ) {
SDL_DestroyMutex(mutex);
}

#ifdef ENABLE_PTH
pth_kill();
#endif
}

/* Routines for manipulating the thread list */
Expand Down
3 changes: 2 additions & 1 deletion src/thread/pth/SDL_systhread.c
Expand Up @@ -64,7 +64,8 @@ int SDL_SYS_CreateThread(SDL_Thread *thread, void *args)
pth_attr_set(type, PTH_ATTR_JOINABLE, TRUE);

/* Create the thread and go! */
if ( pth_spawn(type, RunThread, args) == NULL ) {
thread->handle = pth_spawn(type, RunThread, args);
if ( thread->handle == NULL ) {
SDL_SetError("Not enough resources to create thread");
return(-1);
}
Expand Down

0 comments on commit 89785c6

Please sign in to comment.