This repository was archived by the owner on Oct 3, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +37
-7
lines changed Expand file tree Collapse file tree 2 files changed +37
-7
lines changed Original file line number Diff line number Diff line change @@ -11,10 +11,18 @@ volatile int stoppingEvent;
1111volatile int stopped ;
1212
1313int BCSP_IoIncrement () {
14- if (stoppingFlag ) {
14+ __VERIFIER_atomic_begin ();
15+ int lsf = stoppingFlag ;
16+ __VERIFIER_atomic_end ();
17+ if (lsf ) {
1518 return -1 ;
1619 } else {
17- pendingIo = pendingIo + 1 ;
20+ __VERIFIER_atomic_begin ();
21+ int lp = pendingIo ;
22+ __VERIFIER_atomic_end ();
23+ __VERIFIER_atomic_begin ();
24+ pendingIo = lp + 1 ;
25+ __VERIFIER_atomic_end ();
1826 }
1927 return 0 ;
2028}
@@ -31,7 +39,9 @@ void BCSP_IoDecrement() {
3139 int pending ;
3240 pending = dec ();
3341 if (pending == 0 ) {
42+ __VERIFIER_atomic_begin ();
3443 stoppingEvent = 1 ;
44+ __VERIFIER_atomic_end ();
3545 }
3646}
3747
@@ -46,9 +56,14 @@ void* BCSP_PnpAdd(void* arg) {
4656}
4757
4858void * BCSP_PnpStop (void * arg ) {
59+ __VERIFIER_atomic_begin ();
4960 stoppingFlag = 1 ;
61+ __VERIFIER_atomic_end ();
5062 BCSP_IoDecrement ();
51- assume_abort_if_not (stoppingEvent );
63+ __VERIFIER_atomic_begin ();
64+ int lse = stoppingEvent ;
65+ __VERIFIER_atomic_end ();
66+ assume_abort_if_not (lse );
5267 stopped = 1 ;
5368 return 0 ;
5469}
Original file line number Diff line number Diff line change @@ -699,10 +699,18 @@ volatile int pendingIo;
699699volatile int stoppingEvent;
700700volatile int stopped;
701701int BCSP_IoIncrement () {
702- if (stoppingFlag) {
702+ __VERIFIER_atomic_begin ();
703+ int lsf = stoppingFlag;
704+ __VERIFIER_atomic_end ();
705+ if (lsf) {
703706 return -1 ;
704707 } else {
705- pendingIo = pendingIo + 1 ;
708+ __VERIFIER_atomic_begin ();
709+ int lp = pendingIo;
710+ __VERIFIER_atomic_end ();
711+ __VERIFIER_atomic_begin ();
712+ pendingIo = lp + 1 ;
713+ __VERIFIER_atomic_end ();
706714 }
707715 return 0 ;
708716}
@@ -717,7 +725,9 @@ void BCSP_IoDecrement() {
717725 int pending;
718726 pending = dec ();
719727 if (pending == 0 ) {
720- stoppingEvent = 1 ;
728+ __VERIFIER_atomic_begin ();
729+ stoppingEvent = 1 ;
730+ __VERIFIER_atomic_end ();
721731 }
722732}
723733void * BCSP_PnpAdd (void * arg) {
@@ -730,9 +740,14 @@ void* BCSP_PnpAdd(void* arg) {
730740 return 0 ;
731741}
732742void * BCSP_PnpStop (void * arg) {
743+ __VERIFIER_atomic_begin ();
733744 stoppingFlag = 1 ;
745+ __VERIFIER_atomic_end ();
734746 BCSP_IoDecrement ();
735- assume_abort_if_not (stoppingEvent);
747+ __VERIFIER_atomic_begin ();
748+ int lse = stoppingEvent;
749+ __VERIFIER_atomic_end ();
750+ assume_abort_if_not (lse);
736751 stopped = 1 ;
737752 return 0 ;
738753}
You can’t perform that action at this time.
0 commit comments