From c712ce1480014a23c9c54a89a0fba71456d3b31b Mon Sep 17 00:00:00 2001 From: Symious Date: Thu, 20 Mar 2025 23:44:41 +0800 Subject: [PATCH] move back AMAP --- src/common/utils/AtomicSharedPtrTable.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/common/utils/AtomicSharedPtrTable.h b/src/common/utils/AtomicSharedPtrTable.h index 43be477..66e4195 100644 --- a/src/common/utils/AtomicSharedPtrTable.h +++ b/src/common/utils/AtomicSharedPtrTable.h @@ -32,10 +32,11 @@ 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--; + while (free.find(nextAvail - 1) != free.end()) { + // move back next avail as much as possible + free.erase(--nextAvail); + } } else { free.insert(idx); }