Skip to content

Commit 251b9d4

Browse files
cyx1231stMatan-B
authored andcommitted
crimson/common/tri_mutex: minor cleanup to be consistent
Signed-off-by: Yingxin Cheng <[email protected]> Signed-off-by: Matan Breizman <[email protected]>
1 parent 71eef36 commit 251b9d4

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

src/crimson/common/tri_mutex.cc

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,8 @@ bool tri_mutex::try_lock_for_read() noexcept
8585
if (!writers && !exclusively_used && waiters.empty()) {
8686
++readers;
8787
return true;
88-
} else {
89-
return false;
9088
}
89+
return false;
9190
}
9291

9392
void tri_mutex::unlock_for_read()
@@ -135,11 +134,9 @@ bool tri_mutex::try_lock_for_write() noexcept
135134
{
136135
LOG_PREFIX(tri_mutex::try_lock_for_write());
137136
DEBUGDPP("", *this);
138-
if (!readers && !exclusively_used) {
139-
if (waiters.empty()) {
140-
++writers;
141-
return true;
142-
}
137+
if (!readers && !exclusively_used && waiters.empty()) {
138+
++writers;
139+
return true;
143140
}
144141
return false;
145142
}

0 commit comments

Comments
 (0)