1 #include <ddekit/ddekit.h>
2 #include <ddekit/printf.h>
3 #include <ddekit/thread.h>
4 #include <ddekit/initcall.h>
5 
6 #include <stdio.h>
7 
8 void
9 long_running_thread()
10 {
11 	int x=10;
12 	do {
13 		ddekit_printf("Long Running\n");
14 		ddekit_thread_msleep(2000);
15 		x--;
16 	} while(x >0);
17 }
18 
19 void
20 short_running_thread()
21 {
22 	int x=15;
23 	do {
24 		ddekit_printf("Short Running\n");
25 		ddekit_thread_msleep(500);
26 		x--;
27 	} while(x >0);
28 }
29 
30 void ddekit_minix_wait_exit(void);	/* import from dde-minix */
31 
32 #if 0
33 #include <ucontext.h>
34 ucontext_t ctx;
35 #endif
36 
37 int
38 main(void)
39 {
40 
41 #if 0
42 	getcontext(&ctx);
43 	if (ctx.uc_mcontext.mc_magic != 0xc0ffee) {
44 		printf("FLAG_NONE\n");
45 	}
46 
47 	memset(&ctx,0,sizeof(ucontext_t));
48 	ctx.uc_flags = _UC_IGNSIGM | _UC_IGNFPU;
49 	getcontext(&ctx);
50 	if (ctx.uc_mcontext.mc_magic != 0xc0ffee) {
51 		printf("_UC_IGNSIGM | _UC_IGNFPU FAIL\n");
52 	}
53 
54 	memset(&ctx,0,sizeof(ucontext_t));
55 	ctx.uc_flags = _UC_IGNSIGM ;
56 	getcontext(&ctx);
57 	if (ctx.uc_mcontext.mc_magic != 0xc0ffee) {
58 		printf("_UC_IGNSIGM FAIL\n");
59 	}
60 
61 	memset(&ctx,0,sizeof(ucontext_t));
62 	ctx.uc_flags = _UC_IGNFPU ;
63 	getcontext(&ctx);
64 	if (ctx.uc_mcontext.mc_magic != 0xc0ffee) {
65 		printf("_UC_IGNFPU FAIL\n");
66 	}
67 #endif
68 
69 	ddekit_init();
70 	ddekit_thread_create(long_running_thread, NULL, "Long_thread");
71 	ddekit_thread_create(short_running_thread, NULL, "Short_thread");
72 	ddekit_minix_wait_exit();
73 
74 	return 0;
75 }
76