|
|
1 #include "vera_defines.vrh"
2
3 program task_terminate {
4 task t1 () {
5 printf("%0d Inside t1\n", get_time(LO));
6 fork
7 { t2(); }
8 { t3(); }
9 join none
10 delay(100);
11 printf("%0d terminating t1 child process\n", get_time(LO));
12 terminate;
13 printf("%0d afterterminate in t1\n", get_time(LO));
14
15 }
16
17 task t2 () {
18 printf("%0d Inside t2\n", get_time(LO));
19 fork
20 { t2_t1(); }
21 join none
22 delay(40);
23 printf("%0d Returning from t2\n", get_time(LO));
24 return;
25 }
26
27 task t3 () {
28 while (1) {
29 delay(5);
30 printf("%0d from t2_t1_t1\n", get_time(LO));
31 }
32 }
33
34 task t2_t1 () {
35 printf("%0d Inside t2_t1\n", get_time(LO));
36 fork
37 { t2_t1_t1(); }
38 join none
39 }
40
41 task t2_t1_t1 () {
42 while (1) {
43 delay(4);
44 printf("%0d from t2_t1_t1\n", get_time(LO));
45 }
46 }
47
48 t1();
49 delay(100);
50 printf("%0d terminating program\n", get_time(LO));
51
52 }
You could download file task_terminate.vr here
|