/
githubmirror
/
cmssw
Обзор
Документация
Войти
/
githubmirror
/
cmssw
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
FWCore/Concurrency/interface/ThreadSafeOutputFileStream.h
26 строк
657 B
Chris Jones
Use oneapi namespace
22 дек 2021, 00:32
22 дек 2021, 00:32
6cf8c1a
Код
Авторство
О чём код?
#ifndef FWCore_Concurrency_ThreadSafeOutputFileStream_h #define FWCore_Concurrency_ThreadSafeOutputFileStream_h #include "oneapi/tbb/concurrent_queue.h" #include <atomic> #include <fstream> #include <string> namespace edm { class ThreadSafeOutputFileStream { public: ThreadSafeOutputFileStream(std::string const& name); ~ThreadSafeOutputFileStream(); void write(std::string&& msg); explicit operator bool() const { return static_cast<bool>(file_); } private: std::ofstream file_; std::atomic<bool> msgBeingLogged_{false}; oneapi::tbb::concurrent_queue<std::string> waitingMessages_{}; }; } // namespace edm #endif