Skip to content

Commit f07f668

Browse files
committed
stop workers
1 parent 8de0a1c commit f07f668

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

cachelib/allocator/CacheAllocator-inl.h

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3521,6 +3521,8 @@ bool CacheAllocator<CacheTrait>::stopWorkers(std::chrono::seconds timeout) {
35213521
success &= stopPoolResizer(timeout);
35223522
success &= stopMemMonitor(timeout);
35233523
success &= stopReaper(timeout);
3524+
success &= stopBackgroundEvictor(timeout);
3525+
success &= stopBackgroundPromoter(timeout);
35243526
return success;
35253527
}
35263528

@@ -4021,6 +4023,26 @@ bool CacheAllocator<CacheTrait>::stopReaper(std::chrono::seconds timeout) {
40214023
return stopWorker("Reaper", reaper_, timeout);
40224024
}
40234025

4026+
template <typename CacheTrait>
4027+
bool CacheAllocator<CacheTrait>::stopBackgroundEvictor(std::chrono::seconds timeout) {
4028+
bool result = true;
4029+
for (size_t i = 0; i < backgroundEvictor_.size(); i++) {
4030+
auto ret = stopWorker("BackgroundEvictor", backgroundEvictor_[i], timeout);
4031+
result = result && ret;
4032+
}
4033+
return result;
4034+
}
4035+
4036+
template <typename CacheTrait>
4037+
bool CacheAllocator<CacheTrait>::stopBackgroundPromoter(std::chrono::seconds timeout) {
4038+
bool result = true;
4039+
for (size_t i = 0; i < backgroundPromoter_.size(); i++) {
4040+
auto ret = stopWorker("BackgroundPromoter", backgroundPromoter_[i], timeout);
4041+
result = result && ret;
4042+
}
4043+
return result;
4044+
}
4045+
40244046
template <typename CacheTrait>
40254047
bool CacheAllocator<CacheTrait>::cleanupStrayShmSegments(
40264048
const std::string& cacheDir, bool posix /*TODO(SHM_FILE): const std::vector<CacheMemoryTierConfig>& config */) {

cachelib/allocator/CacheAllocator.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1024,6 +1024,8 @@ class CacheAllocator : public CacheBase {
10241024
0});
10251025
bool stopMemMonitor(std::chrono::seconds timeout = std::chrono::seconds{0});
10261026
bool stopReaper(std::chrono::seconds timeout = std::chrono::seconds{0});
1027+
bool stopBackgroundEvictor(std::chrono::seconds timeout = std::chrono::seconds{0});
1028+
bool stopBackgroundPromoter(std::chrono::seconds timeout = std::chrono::seconds{0});
10271029

10281030
// Set pool optimization to either true or false
10291031
//

0 commit comments

Comments
 (0)