Mercurial > sdl-ios-xcode
comparison src/thread/irix/SDL_systhread.c @ 1895:c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Mon, 10 Jul 2006 21:04:37 +0000 |
parents | d910939febfa |
children | 4436464c4f51 |
comparison
equal
deleted
inserted
replaced
1894:c69cee13dd76 | 1895:c121d94672cb |
---|---|
32 #include "SDL_thread.h" | 32 #include "SDL_thread.h" |
33 #include "../SDL_systhread.h" | 33 #include "../SDL_systhread.h" |
34 | 34 |
35 | 35 |
36 static int sig_list[] = { | 36 static int sig_list[] = { |
37 SIGHUP, SIGINT, SIGQUIT, SIGPIPE, SIGALRM, SIGTERM, SIGCLD, SIGWINCH, | 37 SIGHUP, SIGINT, SIGQUIT, SIGPIPE, SIGALRM, SIGTERM, SIGCLD, SIGWINCH, |
38 SIGVTALRM, SIGPROF, 0 | 38 SIGVTALRM, SIGPROF, 0 |
39 }; | 39 }; |
40 | 40 |
41 | 41 |
42 int SDL_SYS_CreateThread(SDL_Thread *thread, void *args) | 42 int |
43 SDL_SYS_CreateThread(SDL_Thread * thread, void *args) | |
43 { | 44 { |
44 /* Create the thread and go! */ | 45 /* Create the thread and go! */ |
45 if ( sproc(SDL_RunThread, PR_SALL, args) < 0 ) { | 46 if (sproc(SDL_RunThread, PR_SALL, args) < 0) { |
46 SDL_SetError("Not enough resources to create thread"); | 47 SDL_SetError("Not enough resources to create thread"); |
47 return(-1); | 48 return (-1); |
48 } | 49 } |
49 return(0); | 50 return (0); |
50 } | 51 } |
51 | 52 |
52 void SDL_SYS_SetupThread(void) | 53 void |
54 SDL_SYS_SetupThread(void) | |
53 { | 55 { |
54 int i; | 56 int i; |
55 sigset_t mask; | 57 sigset_t mask; |
56 | 58 |
57 /* Mask asynchronous signals for this thread */ | 59 /* Mask asynchronous signals for this thread */ |
58 sigemptyset(&mask); | 60 sigemptyset(&mask); |
59 for ( i=0; sig_list[i]; ++i ) { | 61 for (i = 0; sig_list[i]; ++i) { |
60 sigaddset(&mask, sig_list[i]); | 62 sigaddset(&mask, sig_list[i]); |
61 } | 63 } |
62 sigprocmask(SIG_BLOCK, &mask, NULL); | 64 sigprocmask(SIG_BLOCK, &mask, NULL); |
63 } | 65 } |
64 | 66 |
65 /* WARNING: This may not work for systems with 64-bit pid_t */ | 67 /* WARNING: This may not work for systems with 64-bit pid_t */ |
66 Uint32 SDL_ThreadID(void) | 68 Uint32 |
69 SDL_ThreadID(void) | |
67 { | 70 { |
68 return((Uint32)getpid()); | 71 return ((Uint32) getpid()); |
69 } | 72 } |
70 | 73 |
71 /* WARNING: This may not work for systems with 64-bit pid_t */ | 74 /* WARNING: This may not work for systems with 64-bit pid_t */ |
72 void SDL_WaitThread(SDL_Thread *thread, int *status) | 75 void |
76 SDL_WaitThread(SDL_Thread * thread, int *status) | |
73 { | 77 { |
74 errno = 0; | 78 errno = 0; |
75 while ( errno != ECHILD ) { | 79 while (errno != ECHILD) { |
76 waitpid(thread->handle, NULL, 0); | 80 waitpid(thread->handle, NULL, 0); |
77 } | 81 } |
78 } | 82 } |
79 | 83 |
80 /* WARNING: This may not work for systems with 64-bit pid_t */ | 84 /* WARNING: This may not work for systems with 64-bit pid_t */ |
81 void SDL_KillThread(SDL_Thread *thread) | 85 void |
86 SDL_KillThread(SDL_Thread * thread) | |
82 { | 87 { |
83 kill(thread->handle, SIGKILL); | 88 kill(thread->handle, SIGKILL); |
84 } | 89 } |
85 | 90 |
91 /* vi: set ts=4 sw=4 expandtab: */ |