CMS 3D CMS Logo

ThreadSafeOutputFileStream.h
Go to the documentation of this file.
1 #ifndef FWCore_Concurrency_ThreadSafeOutputFileStream_h
2 #define FWCore_Concurrency_ThreadSafeOutputFileStream_h
3 
4 #include "tbb/concurrent_queue.h"
5 
6 #include <atomic>
7 #include <fstream>
8 #include <string>
9 
10 namespace edm {
12  public:
15 
16  void write(std::string&& msg);
17  explicit operator bool() const { return static_cast<bool>(file_); }
18 
19  private:
20  std::ofstream file_;
21  std::atomic<bool> msgBeingLogged_{false};
22  tbb::concurrent_queue<std::string> waitingMessages_{};
23  };
24 } // namespace edm
25 
26 #endif
edm::ThreadSafeOutputFileStream::~ThreadSafeOutputFileStream
~ThreadSafeOutputFileStream()
Definition: ThreadSafeOutputFileStream.cc:9
electrons_cff.bool
bool
Definition: electrons_cff.py:366
edm
HLT enums.
Definition: AlignableModifier.h:19
edm::ThreadSafeOutputFileStream
Definition: ThreadSafeOutputFileStream.h:11
mps_check.msg
tuple msg
Definition: mps_check.py:285
edm::ThreadSafeOutputFileStream::waitingMessages_
tbb::concurrent_queue< std::string > waitingMessages_
Definition: ThreadSafeOutputFileStream.h:22
edm::ThreadSafeOutputFileStream::ThreadSafeOutputFileStream
ThreadSafeOutputFileStream(std::string const &name)
Definition: ThreadSafeOutputFileStream.cc:7
edm::ThreadSafeOutputFileStream::msgBeingLogged_
std::atomic< bool > msgBeingLogged_
Definition: ThreadSafeOutputFileStream.h:21
edm::ThreadSafeOutputFileStream::write
void write(std::string &&msg)
Definition: ThreadSafeOutputFileStream.cc:17
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
edm::ThreadSafeOutputFileStream::file_
std::ofstream file_
Definition: ThreadSafeOutputFileStream.h:20