Skip to content

Commit e25d9d6

Browse files
committed
Fix operator precedence warning
1 parent ab6dec6 commit e25d9d6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

stl/src/mutex.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ static _Thrd_result mtx_do_lock(_Mtx_t mtx, const _timespec64* target) noexcept
9595

9696
res = WAIT_OBJECT_0;
9797

98-
} else if (target->tv_sec < 0 || target->tv_sec == 0 && target->tv_nsec <= 0) {
98+
} else if (target->tv_sec < 0 || (target->tv_sec == 0 && target->tv_nsec <= 0)) {
9999
// target time <= 0 --> plain trylock or timed wait for time that has passed; try to lock with 0 timeout
100100
if (mtx->_Thread_id != current_thread_id) { // not this thread, lock it
101101
if (TryAcquireSRWLockExclusive(get_srw_lock(mtx)) != 0) {
@@ -109,7 +109,7 @@ static _Thrd_result mtx_do_lock(_Mtx_t mtx, const _timespec64* target) noexcept
109109
// TRANSITION, ABI: this branch is preserved for `_Mtx_timedlock`
110110
_timespec64 now;
111111
_Timespec64_get_sys(&now);
112-
while (now.tv_sec < target->tv_sec || now.tv_sec == target->tv_sec && now.tv_nsec < target->tv_nsec) {
112+
while (now.tv_sec < target->tv_sec || (now.tv_sec == target->tv_sec && now.tv_nsec < target->tv_nsec)) {
113113
// time has not expired
114114
if (mtx->_Thread_id == current_thread_id
115115
|| TryAcquireSRWLockExclusive(get_srw_lock(mtx)) != 0) { // stop waiting

0 commit comments

Comments
 (0)