/
githubmirror
/
nbs
Обзор
Документация
Войти
/
githubmirror
/
nbs
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
library/cpp/yt/stockpile/stockpile_linux.cpp
42 строки
890 B
Anton Myagkov
Update ydb version to 24.4 (#4579)
07 фев 2026, 11:59
Не верифицирован
07 фев 2026, 11:59
2c21cae
Код
Авторство
О чём код?
#include "stockpile.h" #include <thread> #include <mutex> #include <sys/mman.h> #include <util/system/thread.h> namespace NYT { //////////////////////////////////////////////////////////////////////////////// namespace { void RunStockpile(const TStockpileOptions& options) { TThread::SetCurrentThreadName("Stockpile"); constexpr int MADV_STOCKPILE = 0x59410004; while (true) { ::madvise(nullptr, options.BufferSize, MADV_STOCKPILE); Sleep(options.Period); } } } // namespace void ConfigureStockpile(const TStockpileOptions& options) { static std::once_flag OnceFlag; std::call_once(OnceFlag, [options] { for (int i = 0; i < options.ThreadCount; i++) { std::thread(RunStockpile, options).detach(); } }); } //////////////////////////////////////////////////////////////////////////////// } // namespace NYT