comparison src/thread/linux/SDL_systhread.c @ 1336:3692456e7b0f

Use SDL_ prefixed versions of C library functions. FIXME: Change #include <stdlib.h> to #include "SDL_stdlib.h" Change #include <string.h> to #include "SDL_string.h" Make sure nothing else broke because of this...
author Sam Lantinga <slouken@libsdl.org>
date Tue, 07 Feb 2006 06:59:48 +0000
parents c9b51268668f
children 604d73db6802
comparison
equal deleted inserted replaced
1335:c39265384763 1336:3692456e7b0f
170 int SDL_SYS_CreateThread(SDL_Thread *thread, void *args) 170 int SDL_SYS_CreateThread(SDL_Thread *thread, void *args)
171 { 171 {
172 void *stack; 172 void *stack;
173 173
174 /* Allocate memory for thread stack */ 174 /* Allocate memory for thread stack */
175 stack = malloc(STACKSIZE); 175 stack = SDL_malloc(STACKSIZE);
176 if ( stack == (void *)0 ) { 176 if ( stack == (void *)0 ) {
177 SDL_OutOfMemory(); 177 SDL_OutOfMemory();
178 return(-1); 178 return(-1);
179 } 179 }
180 thread->data = stack; 180 thread->data = stack;
184 184
185 /* Create the thread and go! */ 185 /* Create the thread and go! */
186 thread->handle = clone(RunThread, stack, 186 thread->handle = clone(RunThread, stack,
187 (CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND), args); 187 (CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND), args);
188 if ( thread->handle < 0 ) { 188 if ( thread->handle < 0 ) {
189 free(thread->data); 189 SDL_free(thread->data);
190 SDL_SetError("Not enough resources to create thread"); 190 SDL_SetError("Not enough resources to create thread");
191 return(-1); 191 return(-1);
192 } 192 }
193 return(0); 193 return(0);
194 } 194 }
231 "ps ax|fgrep -v fgrep|fgrep -v '<zombie>'|fgrep %d >/dev/null", 231 "ps ax|fgrep -v fgrep|fgrep -v '<zombie>'|fgrep %d >/dev/null",
232 thread->handle); 232 thread->handle);
233 while ( system(command) == 0 ) 233 while ( system(command) == 0 )
234 sleep(1); 234 sleep(1);
235 #endif 235 #endif
236 free(thread->data); 236 SDL_free(thread->data);
237 } 237 }
238 238
239 void SDL_SYS_KillThread(SDL_Thread *thread) 239 void SDL_SYS_KillThread(SDL_Thread *thread)
240 { 240 {
241 kill(thread->handle, SIGKILL); 241 kill(thread->handle, SIGKILL);