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 }
25 
26 #endif
tbb::concurrent_queue< std::string > waitingMessages_
ThreadSafeOutputFileStream(std::string const &name)
tuple msg
Definition: mps_check.py:277
HLT enums.