main
test-branch
| 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.