1 #include <libraries/thread.h>
2 #include <proto/thread.h>
6 void *thread_main(void *data
) {
7 uint32_t id
= CurrentThread();
9 printf("[%d] starting\n", id
);
13 printf("[%d] exiting\n", id
);
18 int main (int argc
, char **argv
) {
22 for (i
= 0; i
< 10; i
++) {
23 id
[i
] = CreateThread(thread_main
, NULL
);
24 printf("created thread %d\n", id
[i
]);
28 for (i
= 0; i
< 10; i
++) {
29 printf("waiting for thread %d\n", id
[i
]);
30 WaitThread(id
[i
], (void **) &ret
);
31 printf("thread %d return %d\n", id
[i
], ret
);