Rev 1125 | Rev 1129 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 1125 | Rev 1128 | ||
|---|---|---|---|
| Line 253... | Line 253... | ||
| 253 | ipc_wait_for_call(&data, 0); |
253 | ipc_wait_for_call(&data, 0); |
| 254 | } |
254 | } |
| 255 | 255 | ||
| 256 | static int ptest(void *arg) |
256 | static int ptest(void *arg) |
| 257 | { |
257 | { |
| 258 | printf("Pseudo thread-1\n"); |
258 | printf("Pseudo thread stage1.\n"); |
| 259 | ps_preempt(); |
259 | psthread_schedule_next(); |
| 260 | printf("Pseudo thread-2\n"); |
260 | printf("Pseudo thread stage2.\n"); |
| 261 | ps_preempt(); |
261 | psthread_schedule_next(); |
| 262 | printf("Pseudo thread-3\n"); |
262 | printf("Pseudo thread stage3.\n"); |
| 263 | ps_preempt(); |
263 | psthread_schedule_next(); |
| 264 | printf("Pseudo thread-4\n"); |
264 | printf("Pseudo thread stage4.\n"); |
| 265 | ps_preempt(); |
265 | psthread_schedule_next(); |
| 266 | printf("Pseudo finish\n"); |
266 | printf("Pseudo thread exiting.\n"); |
| 267 | return 0; |
267 | return 0; |
| 268 | } |
268 | } |
| 269 | 269 | ||
| 270 | int main(int argc, char *argv[]) |
270 | int main(int argc, char *argv[]) |
| 271 | { |
271 | { |
| Line 306... | Line 306... | ||
| 306 | 306 | ||
| 307 | if (futex_up(&ftx) < 0) |
307 | if (futex_up(&ftx) < 0) |
| 308 | printf("Futex failed.\n"); |
308 | printf("Futex failed.\n"); |
| 309 | 309 | ||
| 310 | ptid = psthread_create(ptest, NULL); |
310 | ptid = psthread_create(ptest, NULL); |
| 311 | printf("main thread-1\n"); |
311 | printf("Main thread stage1.\n"); |
| 312 | ps_preempt(); |
312 | psthread_schedule_next();; |
| 313 | printf("main thread-2\n"); |
313 | printf("Main thread stage2.\n"); |
| 314 | ps_preempt(); |
314 | psthread_schedule_next();; |
| 315 | printf("main thread-3\n"); |
315 | printf("Main thread stage3.\n"); |
| 316 | 316 | ||
| 317 | ps_join(ptid); |
317 | psthread_join(ptid); |
| 318 | printf("Main exiting\n"); |
- | |
| 319 | 318 | ||
| 320 | printf("Main thread exiting.\n"); |
319 | printf("Main thread exiting.\n"); |
| 321 | return 0; |
320 | return 0; |
| 322 | } |
321 | } |