source: CIVL/examples/pthread/esbmc/fib_bench_false.c@ d5abab8

1.23 2.0 main test-branch
Last change on this file since d5abab8 was 6109557, checked in by John Edenhofner <johneden@…>, 11 years ago

Updated libraries and modeltranslator for svcomp files

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

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