Skip to content
Merged
Changes from all 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 cpp/core/utils/ObjectStore.cc
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,13 @@ std::pair<gluten::ObjectStore*, gluten::ResourceHandle> gluten::ObjectStore::loo

gluten::ObjectStore::~ObjectStore() {
for (;;) {
if (aliveObjects_.empty()) {
break;
}
std::shared_ptr<void> tempObj;
{
const std::lock_guard<std::mutex> lock(mtx_);
// The empty-check and the pop of the last alive object must be atomic under `mtx_`.
if (aliveObjects_.empty()) {
break;
}
// destructing in reversed order (the last added object destructed first)
auto itr = aliveObjects_.rbegin();
const ResourceHandle handle = (*itr).first;
Expand Down
Loading