comparison src/thread/amigaos/SDL_systhread.c @ 1668:4da1ee79c9af SDL-1.3

more tweaking indent options
author Sam Lantinga <slouken@libsdl.org>
date Mon, 29 May 2006 04:04:35 +0000
parents 782fd950bd46
children
comparison
equal deleted inserted replaced
1667:1fddae038bc8 1668:4da1ee79c9af
39 39
40 #ifndef MORPHOS 40 #ifndef MORPHOS
41 41
42 #if defined(__SASC) && !defined(__PPC__) 42 #if defined(__SASC) && !defined(__PPC__)
43 __saveds __asm Uint32 43 __saveds __asm Uint32
44 RunThread (register __a0 char *args) 44 RunThread(register __a0 char *args)
45 #elif defined(__PPC__) 45 #elif defined(__PPC__)
46 Uint32 46 Uint32
47 RunThread (char *args) 47 RunThread(char *args)
48 #else 48 #else
49 Uint32 __saveds 49 Uint32 __saveds
50 RunThread (char *args __asm ("a0")) 50 RunThread(char *args __asm("a0"))
51 #endif 51 #endif
52 { 52 {
53 #ifdef STORMC4_WOS 53 #ifdef STORMC4_WOS
54 thread_args *data = (thread_args *) args; 54 thread_args *data = (thread_args *) args;
55 #else 55 #else
56 thread_args *data = (thread_args *) atol (args); 56 thread_args *data = (thread_args *) atol(args);
57 #endif 57 #endif
58 58
59 struct Task *Father; 59 struct Task *Father;
60 60
61 D (bug ("Received data: %lx\n", data)); 61 D(bug("Received data: %lx\n", data));
62 Father = data->wait; 62 Father = data->wait;
63 63
64 SDL_RunThread (data); 64 SDL_RunThread(data);
65 65
66 Signal (Father, SIGBREAKF_CTRL_F); 66 Signal(Father, SIGBREAKF_CTRL_F);
67 D (bug ("Thread with data %lx ended\n", data)); 67 D(bug("Thread with data %lx ended\n", data));
68 return (0); 68 return (0);
69 } 69 }
70 70
71 #else 71 #else
72 72
73 #include <emul/emulinterface.h> 73 #include <emul/emulinterface.h>
74 74
75 Uint32 75 Uint32
76 RunTheThread (void) 76 RunTheThread(void)
77 { 77 {
78 thread_args *data = (thread_args *) atol ((char *) REG_A0); 78 thread_args *data = (thread_args *) atol((char *) REG_A0);
79 struct Task *Father; 79 struct Task *Father;
80 80
81 D (bug ("Received data: %lx\n", data)); 81 D(bug("Received data: %lx\n", data));
82 Father = data->wait; 82 Father = data->wait;
83 83
84 SDL_RunThread (data); 84 SDL_RunThread(data);
85 85
86 Signal (Father, SIGBREAKF_CTRL_F); 86 Signal(Father, SIGBREAKF_CTRL_F);
87 D (bug ("Thread with data %lx ended\n", data)); 87 D(bug("Thread with data %lx ended\n", data));
88 return (0); 88 return (0);
89 } 89 }
90 90
91 struct EmulLibEntry RunThreadStruct = { 91 struct EmulLibEntry RunThreadStruct = {
92 TRAP_LIB, 92 TRAP_LIB,
97 void *RunThread = &RunThreadStruct; 97 void *RunThread = &RunThreadStruct;
98 #endif 98 #endif
99 99
100 100
101 int 101 int
102 SDL_SYS_CreateThread (SDL_Thread * thread, void *args) 102 SDL_SYS_CreateThread(SDL_Thread * thread, void *args)
103 { 103 {
104 /* Create the thread and go! */ 104 /* Create the thread and go! */
105 char buffer[20]; 105 char buffer[20];
106 106
107 D (bug ("Sending %lx to the new thread...\n", args)); 107 D(bug("Sending %lx to the new thread...\n", args));
108 108
109 if (args) 109 if (args)
110 SDL_snprintf (buffer, SDL_arraysize (buffer), "%ld", args); 110 SDL_snprintf(buffer, SDL_arraysize(buffer), "%ld", args);
111 111
112 #ifdef STORMC4_WOS 112 #ifdef STORMC4_WOS
113 thread->handle = CreateTaskPPCTags (TASKATTR_CODE, RunThread, 113 thread->handle = CreateTaskPPCTags(TASKATTR_CODE, RunThread,
114 TASKATTR_NAME, "SDL subtask", 114 TASKATTR_NAME, "SDL subtask",
115 TASKATTR_STACKSIZE, 100000, 115 TASKATTR_STACKSIZE, 100000,
116 (args ? TASKATTR_R3 : TAG_IGNORE), 116 (args ? TASKATTR_R3 : TAG_IGNORE),
117 args, TASKATTR_INHERITR2, TRUE, 117 args, TASKATTR_INHERITR2, TRUE,
118 TAG_DONE); 118 TAG_DONE);
119 #else 119 #else
120 thread->handle = (struct Task *) CreateNewProcTags (NP_Output, Output (), 120 thread->handle = (struct Task *) CreateNewProcTags(NP_Output, Output(),
121 NP_Name, 121 NP_Name,
122 (ULONG) "SDL subtask", 122 (ULONG) "SDL subtask",
123 NP_CloseOutput, FALSE, 123 NP_CloseOutput, FALSE,
124 NP_StackSize, 20000, 124 NP_StackSize, 20000,
125 NP_Entry, 125 NP_Entry,
126 (ULONG) RunThread, 126 (ULONG) RunThread,
127 args ? NP_Arguments : 127 args ? NP_Arguments :
128 TAG_IGNORE, 128 TAG_IGNORE,
129 (ULONG) buffer, 129 (ULONG) buffer,
130 TAG_DONE); 130 TAG_DONE);
131 #endif 131 #endif
132 132
133 if (!thread->handle) { 133 if (!thread->handle) {
134 SDL_SetError ("Not enough resources to create thread"); 134 SDL_SetError("Not enough resources to create thread");
135 return (-1); 135 return (-1);
136 } 136 }
137 137
138 return (0); 138 return (0);
139 } 139 }
140 140
141 void 141 void
142 SDL_SYS_SetupThread (void) 142 SDL_SYS_SetupThread(void)
143 { 143 {
144 } 144 }
145 145
146 Uint32 146 Uint32
147 SDL_ThreadID (void) 147 SDL_ThreadID(void)
148 { 148 {
149 return ((Uint32) FindTask (NULL)); 149 return ((Uint32) FindTask(NULL));
150 } 150 }
151 151
152 void 152 void
153 SDL_SYS_WaitThread (SDL_Thread * thread) 153 SDL_SYS_WaitThread(SDL_Thread * thread)
154 { 154 {
155 SetSignal (0L, SIGBREAKF_CTRL_F | SIGBREAKF_CTRL_C); 155 SetSignal(0L, SIGBREAKF_CTRL_F | SIGBREAKF_CTRL_C);
156 Wait (SIGBREAKF_CTRL_F | SIGBREAKF_CTRL_C); 156 Wait(SIGBREAKF_CTRL_F | SIGBREAKF_CTRL_C);
157 } 157 }
158 158
159 void 159 void
160 SDL_SYS_KillThread (SDL_Thread * thread) 160 SDL_SYS_KillThread(SDL_Thread * thread)
161 { 161 {
162 Signal ((struct Task *) thread->handle, SIGBREAKF_CTRL_C); 162 Signal((struct Task *) thread->handle, SIGBREAKF_CTRL_C);
163 } 163 }
164 164
165 /* vi: set ts=4 sw=4 expandtab: */ 165 /* vi: set ts=4 sw=4 expandtab: */