/
githubmirror
/
cmssw
Обзор
Документация
Войти
/
githubmirror
/
cmssw
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
FWCore/Concurrency/src/ThreadSafeOutputFileStream.cc
28 строк
747 B
W. David Dagenhart
Changes from scram build code-format-all
03 май 2019, 18:48
03 май 2019, 18:48
22c28dc
Код
Авторство
О чём код?
#include "FWCore/Concurrency/interface/ThreadSafeOutputFileStream.h" #include <sstream> namespace edm { ThreadSafeOutputFileStream::ThreadSafeOutputFileStream(std::string const& name) : file_{name} {} ThreadSafeOutputFileStream::~ThreadSafeOutputFileStream() { std::string tmp; while (waitingMessages_.try_pop(tmp)) { file_ << tmp; } file_.close(); } void ThreadSafeOutputFileStream::write(std::string&& msg) { waitingMessages_.push(std::move(msg)); bool expected{false}; if (msgBeingLogged_.compare_exchange_strong(expected, true)) { std::string tmp; while (waitingMessages_.try_pop(tmp)) { file_ << tmp; } msgBeingLogged_.store(false); } } } // namespace edm