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:
648 bytes
|
| Line | |
|---|
| 1 | //Symmetry-Aware Predicate Abstraction for Shared-Variable Concurrent Programs (Extended Technical Report). CoRR abs/1102.2330 (2011)
|
|---|
| 2 |
|
|---|
| 3 | #include <pthread.h>
|
|---|
| 4 |
|
|---|
| 5 | #define assume(e) __VERIFIER_assume(e)
|
|---|
| 6 | #define assert(e) { if(!(e)) { ERROR: goto ERROR; (void)0; } }
|
|---|
| 7 |
|
|---|
| 8 | unsigned int r = 0;
|
|---|
| 9 | unsigned int s = 0;
|
|---|
| 10 |
|
|---|
| 11 | void __VERIFIER_atomic_inc_r()
|
|---|
| 12 | {
|
|---|
| 13 | assume(r!=-1); //to avoid overflows
|
|---|
| 14 | r = r + 1;
|
|---|
| 15 | }
|
|---|
| 16 |
|
|---|
| 17 | void* thr1(void* arg){
|
|---|
| 18 | unsigned int l = 0;
|
|---|
| 19 |
|
|---|
| 20 | __VERIFIER_atomic_inc_r();
|
|---|
| 21 | if(r == 1){
|
|---|
| 22 | L3: s = s + 1;
|
|---|
| 23 | l = l + 1;
|
|---|
| 24 | assert(s == l);
|
|---|
| 25 | goto L3;
|
|---|
| 26 | }
|
|---|
| 27 |
|
|---|
| 28 | return 0;
|
|---|
| 29 | }
|
|---|
| 30 |
|
|---|
| 31 | int main(){
|
|---|
| 32 | pthread_t t;
|
|---|
| 33 |
|
|---|
| 34 | while(1){
|
|---|
| 35 | pthread_create(&t, 0, thr1, 0);
|
|---|
| 36 | }
|
|---|
| 37 | }
|
|---|
| 38 |
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.