source: CIVL/examples/pthread/esbmc/fib_bench_longest_false.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: 669 bytes
Line 
1#include <pthread.h>
2
3void __VERIFIER_assert(int expression) { if (!expression) { ERROR: goto ERROR; }; return; }
4
5int i=1, j=1;
6
7#define NUM 11
8
9void *
10t1(void* arg)
11{
12 int k = 0;
13
14 for (k = 0; k < NUM; k++)
15 i+=j;
16
17 pthread_exit(NULL);
18}
19
20void *
21t2(void* arg)
22{
23 int k = 0;
24
25 for (k = 0; k < NUM; k++)
26 j+=i;
27
28 pthread_exit(NULL);
29}
30
31int
32main(int argc, char **argv)
33{
34 pthread_t id1, id2;
35
36 pthread_create(&id1, NULL, t1, NULL);
37 pthread_create(&id2, NULL, t2, NULL);
38
39 pthread_join(id1, 0);
40 pthread_join(id2, 0);
41
42 printf(" %d \n", i);
43 printf(" %d \n", j);
44 if (i >= 46368 || j >= 46368) {
45 ERROR:
46 goto ERROR;
47 }
48
49 return 0;
50}
Note: See TracBrowser for help on using the repository browser.