source: CIVL/examples/pthread/esbmc/fib_bench_longer_true.c@ e0fc189

1.23 2.0 main test-branch
Last change on this file since e0fc189 was e3151da, checked in by Ziqing Luo <ziqing@…>, 11 years ago

re-organized example directory

git-svn-id: svn://vsl.cis.udel.edu/civl/trunk@1763 fb995dde-84ed-4084-dfe6-e5aef3e2452c

  • Property mode set to 100644
File size: 515 bytes
Line 
1#include <pthread.h>
2
3int i=1, j=1;
4
5#define NUM 6
6
7void *
8t1(void* arg)
9{
10 int k = 0;
11
12 for (k = 0; k < NUM; k++)
13 i+=j;
14
15 pthread_exit(NULL);
16}
17
18void *
19t2(void* arg)
20{
21 int k = 0;
22
23 for (k = 0; k < NUM; k++)
24 j+=i;
25
26 pthread_exit(NULL);
27}
28
29int
30main(int argc, char **argv)
31{
32 pthread_t id1, id2;
33
34 pthread_create(&id1, NULL, t1, NULL);
35 pthread_create(&id2, NULL, t2, NULL);
36
37 pthread_join(id1, 0);
38 pthread_join(id2, 0);
39
40 if (i > 377 || j > 377) {
41 ERROR:
42 goto ERROR;
43 }
44
45 return 0;
46}
Note: See TracBrowser for help on using the repository browser.