"Fossies" - the Fresh Open Source Software Archive 
Member "FunctionCheck-3.2.0/test/simple_test_thread.c" (26 May 2012, 880 Bytes) of package /linux/privat/old/FunctionCheck-3.2.0.tar.gz:
As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style:
standard) with prefixed line numbers and
code folding option.
Alternatively you can here
view or
download the uninterpreted source code file.
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <unistd.h>
4 #include <pthread.h>
5
6 int f1(int n)
7 {
8 int i, j = 0;
9
10
11 for (i = 0; i < n; i++)
12 {
13 j++;
14 }
15 return j;
16 }
17
18 int f2(int n)
19 {
20 int i, j = 0;
21
22
23 for (i = 0; i < n; i++)
24 {
25 j += 2;
26 }
27 return j;
28 }
29
30 int rec4()
31 {
32 return -1;
33 }
34
35 int rec3()
36 {
37 return rec4();
38 }
39
40 int rec2()
41 {
42 return rec3();
43 }
44
45 int rec1()
46 {
47 return rec2();
48 }
49
50 int combo(int n)
51 {
52 return (f1(n) + f2(n));
53 }
54
55 void *start_control(void *data)
56 {
57 f2(10);
58
59 return NULL;
60 }
61
62 int main(int argc, char*argv[])
63 {
64 pthread_t tid;
65 int data = 10;
66 void *ret = NULL;
67
68 printf("Simple test program for functioncheck...\n");
69 rec1();
70
71 combo(20);
72
73 pthread_create(&tid, NULL, start_control, (void*) (&data));
74
75 f1(5);
76
77 pthread_join(tid, &ret);
78
79 printf("byebye.\n");
80
81 return 0;
82 }