diff src/thread/pth/SDL_systhread.c @ 329:1d74ddc90cb2

Patrice's fixes for GNU Pthread support
author Sam Lantinga <slouken@libsdl.org>
date Mon, 01 Apr 2002 15:35:28 +0000
parents af42e7c4c860
children 283d348cb624
line wrap: on
line diff
--- a/src/thread/pth/SDL_systhread.c	Sun Mar 31 04:07:05 2002 +0000
+++ b/src/thread/pth/SDL_systhread.c	Mon Apr 01 15:35:28 2002 +0000
@@ -25,7 +25,11 @@
  "@(#) $Id$";
 #endif
 
-/* Pth thread management routines for SDL */
+/*
+ *	GNU pth threads
+ *
+ *	Patrice Mandin
+ */
 
 #include "SDL_error.h"
 #include "SDL_thread.h"
@@ -51,17 +55,16 @@
 {
 	pth_attr_t type;
 
+	/* Create a new attribute */
 	type = pth_attr_new();
-
-	/* Set the thread attributes */
-	if ( pth_attr_init(type) != 0 ) {
+	if ( type == NULL ) {
 		SDL_SetError("Couldn't initialize pth attributes");
 		return(-1);
 	}
 	pth_attr_set(type, PTH_ATTR_JOINABLE, TRUE);
 
 	/* Create the thread and go! */
-	if ( pth_spawn(type, RunThread, args) != 0 ) {
+	if ( pth_spawn(type, RunThread, args) == NULL ) {
 		SDL_SetError("Not enough resources to create thread");
 		return(-1);
 	}
@@ -72,6 +75,7 @@
 {
 	int i;
 	sigset_t mask;
+	int oldstate;
 
 	/* Mask asynchronous signals for this thread */
 	sigemptyset(&mask);
@@ -81,9 +85,7 @@
 	pth_sigmask(SIG_BLOCK, &mask, 0);
 
 	/* Allow ourselves to be asynchronously cancelled */
-	{ int oldstate;
-		pth_cancel_state(PTH_CANCEL_ASYNCHRONOUS, &oldstate);
-	}
+	pth_cancel_state(PTH_CANCEL_ASYNCHRONOUS, &oldstate);
 }
 
 /* WARNING:  This may not work for systems with 64-bit pid_t */