1 #include <libraries/thread.h>
2 #include <proto/thread.h>
7 void *thread_main(void *data
) {
8 uint32_t id
= CurrentThread();
11 printf("[%d] starting\n", id
);
13 for (i
= 0; i
< 10; i
++) {
14 printf("[%d] count: %d\n", id
, i
);
18 printf("[%d] exiting\n", id
);
23 int main (int argc
, char **argv
) {
26 t1
= CreateThread(thread_main
, NULL
);
27 printf("created thread %d\n", t1
);
31 t2
= CreateThread(thread_main
, NULL
);
32 printf("created thread %d\n", t2
);
34 printf("waiting for thread %d\n", t2
);
36 printf("thread %d completed\n", t2
);
38 printf("waiting for thread %d\n", t1
);
40 printf("thread %d completed\n", t1
);