source: CIVL/examples/translation/pthread/fib_bench_longest_false.c@ 4540352

1.23 2.0 main test-branch
Last change on this file since 4540352 was 1d26ee6, checked in by John Edenhofner <johneden@…>, 12 years ago

Updated examples

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

  • Property mode set to 100644
File size: 643 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 if (i >= 46368 || j >= 46368) {
43 $assert(false);
44 //ERROR:
45 //goto ERROR;
46 }
47
48 return 0;
49}
Note: See TracBrowser for help on using the repository browser.