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: 7 additions & 0 deletions cachelib/allocator/Handle.h
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,12 @@ struct ReadHandleImpl {
}
}

protected:
friend class ReadHandleImpl;
// Method used only by ReadHandleImpl ctor
void discard() {
it_.store(nullptr, std::memory_order_relaxed);
}
private:
// we are waiting on Item* to be set to a value. One of the valid values is
// nullptr. So choose something that we dont expect to indicate a ptr
Expand Down Expand Up @@ -475,6 +481,7 @@ struct ReadHandleImpl {
if (it_ && it_->isIncomplete()) {
waitContext_ = std::make_shared<ItemWaitContext>(alloc);
if (!alloc_->addWaitContextForMovingItem(it->getKey(), waitContext_)) {
waitContext_->discard();
waitContext_.reset();
}
}
Expand Down