Skip to content
Open
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/common/utils/AtomicSharedPtrTable.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,10 @@ struct AvailSlots {

std::lock_guard lock(mutex);
if (idx == nextAvail - 1) {
while (free.find(--nextAvail) != free.end()) {
// move back next avail as much as possible
;
nextAvail--;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We prefer the prefix operator here when the result is not needed.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right. But for a tiny style issue, I think the fix is good.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@echaozh Thank you for the review, updated the PR, PTAL.

while (free.find(nextAvail - 1) != free.end()) {
// move back next avail as much as possible
free.erase(--nextAvail);
}
} else {
free.insert(idx);
Expand Down