We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 043df5f + c95b2b3 commit 019b2a5Copy full SHA for 019b2a5
cachelib/allocator/Handle.h
@@ -392,6 +392,12 @@ struct ReadHandleImpl {
392
}
393
394
395
+ protected:
396
+ friend class ReadHandleImpl;
397
+ // Method used only by ReadHandleImpl ctor
398
+ void discard() {
399
+ it_.store(nullptr, std::memory_order_relaxed);
400
+ }
401
private:
402
// we are waiting on Item* to be set to a value. One of the valid values is
403
// nullptr. So choose something that we dont expect to indicate a ptr
@@ -475,6 +481,7 @@ struct ReadHandleImpl {
475
481
if (it_ && it_->isIncomplete()) {
476
482
waitContext_ = std::make_shared<ItemWaitContext>(alloc);
477
483
if (!alloc_->addWaitContextForMovingItem(it->getKey(), waitContext_)) {
484
+ waitContext_->discard();
478
485
waitContext_.reset();
479
486
480
487
0 commit comments