main
test-branch
|
Last change
on this file since 1aaefd4 was ea777aa, checked in by Alex Wilton <awilton@…>, 3 years ago |
|
Moved examples, include, build_default.properties, common.xml, and README out from dev.civl.com into the root of the repo.
git-svn-id: svn://vsl.cis.udel.edu/civl/trunk@5704 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 |
|
|---|
| 6 | int x=1, m=0;
|
|---|
| 7 |
|
|---|
| 8 | void __VERIFIER_atomic_acquire()
|
|---|
| 9 | {
|
|---|
| 10 | assume(m==0);
|
|---|
| 11 | m = 1;
|
|---|
| 12 | }
|
|---|
| 13 |
|
|---|
| 14 | void __VERIFIER_atomic_release()
|
|---|
| 15 | {
|
|---|
| 16 | assume(m==1);
|
|---|
| 17 | m = 0;
|
|---|
| 18 | }
|
|---|
| 19 |
|
|---|
| 20 | void* 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 |
|
|---|
| 30 | int 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.