Re-enabled use of AROS.Boot file due to lack of general enthusiasm for
[tangerine.git] / test / threads / twothreads.c
blobdd2fa5703d785d73ef5436abf4a3726240a634e2
1 #include <libraries/thread.h>
2 #include <proto/thread.h>
3 #include <proto/dos.h>
4 #include <stdio.h>
5 #include <stdint.h>
7 void *thread_main(void *data) {
8 uint32_t id = CurrentThread();
9 int i;
11 printf("[%d] starting\n", id);
13 for (i = 0; i < 10; i++) {
14 printf("[%d] count: %d\n", id, i);
15 Delay(25);
18 printf("[%d] exiting\n", id);
20 return NULL;
23 int main (int argc, char **argv) {
24 uint32_t t1, t2;
26 t1 = CreateThread(thread_main, NULL);
27 printf("created thread %d\n", t1);
29 Delay(100);
31 t2 = CreateThread(thread_main, NULL);
32 printf("created thread %d\n", t2);
34 printf("waiting for thread %d\n", t2);
35 WaitThread(t2, NULL);
36 printf("thread %d completed\n", t2);
38 printf("waiting for thread %d\n", t1);
39 WaitThread(t1, NULL);
40 printf("thread %d completed\n", t1);
42 return 0;