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