source: CIVL/mods/dev.civl.com/examples/pthread/cprover/14_spin2003_true.c@ cb4d4f4

main test-branch
Last change on this file since cb4d4f4 was aad342c, checked in by Stephen Siegel <siegel@…>, 3 years ago

Performing huge refactor to incorporate ABC, GMC, and SARL into CIVL repo and use Java modules.

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

  • Property mode set to 100644
File size: 488 bytes
Line 
1#include <pthread.h>
2
3#define assume(e) __VERIFIER_assume(e)
4#define assert(e) { if(!(e)) { ERROR: goto ERROR; (void)0; } }
5
6int x=1, m=0;
7
8void __VERIFIER_atomic_acquire()
9{
10 assume(m==0);
11 m = 1;
12}
13
14void __VERIFIER_atomic_release()
15{
16 assume(m==1);
17 m = 0;
18}
19
20void* thr1(void* arg) {
21 __VERIFIER_atomic_acquire(); // m=0 /\ m'=1
22 x = 0;
23 x = 1;
24 assert(x>=1);
25 __VERIFIER_atomic_release();
26
27 return 0;
28}
29
30int main()
31{
32 pthread_t t;
33
34 while(1) pthread_create(&t, 0, thr1, 0);
35}
36
Note: See TracBrowser for help on using the repository browser.