Rune - Content-locking work 1/2
[rune.git] / tests / ttest.c
1 /*
2  * TTEST.C
3  *
4  * (c)Copyright 1993-2014, Matthew Dillon, All Rights Reserved.  See the  
5  *    COPYRIGHT file at the base of the distribution.
6  */
7
8 #include "defs.h"
9
10 COPYRIGHT_MESSAGE;
11
12 static void envstart(void *data);
13 static void func(void *data);
14
15 int
16 main(int ac, char **av)
17 {
18         threadEnvironmentStart(envstart, NULL, 0);
19         puts("main done");
20         return(0);
21 }
22
23 static void
24 envstart(void *data)
25 {
26         threadCreate(func, "A");
27         threadCreate(func, "B");
28         threadCreate(func, "C");
29         threadCreate(func, "D");
30 }
31
32 static void
33 func(void *data)
34 {
35         static int Count;
36
37         for (;;) {
38                 printf("%p %s\n", &data, (char *)data);
39                 if (++Count == 10) {
40                         Count = 0;
41                         threadCreate(func, data);
42                         return;
43                 }
44                 threadSwitch();
45         }
46 }