Print this page
5083 avoid undefined order of operations in assignments
*** 695,705 ****
* Otherwise, if there are either no waiters, there may in fact be
* pollers, so we do not signal in that case.
*/
if (mblist->mbl_pollers > 0 && mblist->mbl_waiters > 0) {
/* flip the signal value */
! mblist->mbl_signal = (++mblist->mbl_signal) % 2;
} else if (mblist->mbl_waiters > 0) {
mblist->mbl_signal = 1;
} else {
mblist->mbl_signal = 0;
}
--- 695,705 ----
* Otherwise, if there are either no waiters, there may in fact be
* pollers, so we do not signal in that case.
*/
if (mblist->mbl_pollers > 0 && mblist->mbl_waiters > 0) {
/* flip the signal value */
! mblist->mbl_signal = (mblist->mbl_signal + 1) % 2;
} else if (mblist->mbl_waiters > 0) {
mblist->mbl_signal = 1;
} else {
mblist->mbl_signal = 0;
}