source: CIVL/examples/pthread/stateful01_false.cvl@ 325d439

1.23 2.0 main test-branch
Last change on this file since 325d439 was 38374b7, checked in by John Edenhofner <johneden@…>, 12 years ago

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

  • Property mode set to 100644
File size: 966 bytes
Line 
1/**
2* This is a translation of a Pthread program from
3* the Pthread benchmarks of SV-COMP 2014.
4* https://svn.sosy-lab.org/software/sv-benchmarks/tags/svcomp14/
5*
6* Command line execution:
7* civl verify stateful01_false.cvl -min
8*/
9
10#include <civlc.h>
11#include "pthread.cvh"
12
13pthread_mutex_t ma, mb;
14int data1, data2;
15
16void *thread1(void*arg)
17{
18 pthread_mutex_lock(&ma);
19 data1++;
20 pthread_mutex_unlock(&ma);
21
22 pthread_mutex_lock(&ma);
23 data2++;
24 pthread_mutex_unlock(&ma);
25}
26
27void *thread2(void*arg)
28{
29 pthread_mutex_lock(&ma);
30 data1+=5;
31 pthread_mutex_unlock(&ma);
32
33 pthread_mutex_lock(&ma);
34 data2-=6;
35 pthread_mutex_unlock(&ma);
36}
37
38void main()
39{
40 pthread_t t1, t2;
41
42 pthread_mutex_init(&ma, 0);
43 pthread_mutex_init(&mb, 0);
44
45 data1 = 10;
46 data2 = 10;
47
48 pthread_create(&t1, 0, thread1, 0);
49 pthread_create(&t2, 0, thread2, 0);
50
51 pthread_join(t1, 0);
52 pthread_join(t2, 0);
53
54 if (data1==16 && data2==5)
55 {
56 $assert($false);
57 }
58}
Note: See TracBrowser for help on using the repository browser.