src/thread/pth/SDL_systhread.c
changeset 329 1d74ddc90cb2
parent 321 af42e7c4c860
child 397 283d348cb624
     1.1 --- a/src/thread/pth/SDL_systhread.c	Sun Mar 31 04:07:05 2002 +0000
     1.2 +++ b/src/thread/pth/SDL_systhread.c	Mon Apr 01 15:35:28 2002 +0000
     1.3 @@ -25,7 +25,11 @@
     1.4   "@(#) $Id$";
     1.5  #endif
     1.6  
     1.7 -/* Pth thread management routines for SDL */
     1.8 +/*
     1.9 + *	GNU pth threads
    1.10 + *
    1.11 + *	Patrice Mandin
    1.12 + */
    1.13  
    1.14  #include "SDL_error.h"
    1.15  #include "SDL_thread.h"
    1.16 @@ -51,17 +55,16 @@
    1.17  {
    1.18  	pth_attr_t type;
    1.19  
    1.20 +	/* Create a new attribute */
    1.21  	type = pth_attr_new();
    1.22 -
    1.23 -	/* Set the thread attributes */
    1.24 -	if ( pth_attr_init(type) != 0 ) {
    1.25 +	if ( type == NULL ) {
    1.26  		SDL_SetError("Couldn't initialize pth attributes");
    1.27  		return(-1);
    1.28  	}
    1.29  	pth_attr_set(type, PTH_ATTR_JOINABLE, TRUE);
    1.30  
    1.31  	/* Create the thread and go! */
    1.32 -	if ( pth_spawn(type, RunThread, args) != 0 ) {
    1.33 +	if ( pth_spawn(type, RunThread, args) == NULL ) {
    1.34  		SDL_SetError("Not enough resources to create thread");
    1.35  		return(-1);
    1.36  	}
    1.37 @@ -72,6 +75,7 @@
    1.38  {
    1.39  	int i;
    1.40  	sigset_t mask;
    1.41 +	int oldstate;
    1.42  
    1.43  	/* Mask asynchronous signals for this thread */
    1.44  	sigemptyset(&mask);
    1.45 @@ -81,9 +85,7 @@
    1.46  	pth_sigmask(SIG_BLOCK, &mask, 0);
    1.47  
    1.48  	/* Allow ourselves to be asynchronously cancelled */
    1.49 -	{ int oldstate;
    1.50 -		pth_cancel_state(PTH_CANCEL_ASYNCHRONOUS, &oldstate);
    1.51 -	}
    1.52 +	pth_cancel_state(PTH_CANCEL_ASYNCHRONOUS, &oldstate);
    1.53  }
    1.54  
    1.55  /* WARNING:  This may not work for systems with 64-bit pid_t */