test
Main Page
Namespaces
Classes
Package Documentation
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Pages
FWCore
Concurrency
src
ThreadSafeOutputFileStream.cc
Go to the documentation of this file.
1
#include "
FWCore/Concurrency/interface/ThreadSafeOutputFileStream.h
"
2
3
#include <sstream>
4
5
namespace
edm {
6
7
ThreadSafeOutputFileStream::ThreadSafeOutputFileStream
(
std::string
const
&
name
)
8
: file_{name}
9
{}
10
11
ThreadSafeOutputFileStream::~ThreadSafeOutputFileStream
()
12
{
13
std::string
tmp
;
14
while
(
waitingMessages_
.try_pop(tmp)) {
15
file_
<<
tmp
;
16
}
17
file_
.close();
18
}
19
20
void
21
ThreadSafeOutputFileStream::write
(
std::string
&&
msg
)
22
{
23
waitingMessages_
.push(
std::move
(
msg
));
24
bool
expected {
false
};
25
if
(
msgBeingLogged_
.compare_exchange_strong(expected,
true
)) {
26
std::string
tmp
;
27
while
(
waitingMessages_
.try_pop(tmp)) {
28
file_
<<
tmp
;
29
}
30
msgBeingLogged_
.store(
false
);
31
}
32
}
33
}
ThreadSafeOutputFileStream.h
visualization-live-secondInstance_cfg.msg
string msg
Definition:
visualization-live-secondInstance_cfg.py:16
mergeVDriftHistosByStation.name
string name
Definition:
mergeVDriftHistosByStation.py:77
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:255
edm::ThreadSafeOutputFileStream::waitingMessages_
tbb::concurrent_queue< std::string > waitingMessages_
Definition:
ThreadSafeOutputFileStream.h:22
edm::ThreadSafeOutputFileStream::msgBeingLogged_
std::atomic< bool > msgBeingLogged_
Definition:
ThreadSafeOutputFileStream.h:21
eostools.move
def move
Definition:
eostools.py:510
edm::ThreadSafeOutputFileStream::ThreadSafeOutputFileStream
ThreadSafeOutputFileStream(std::string const &name)
Definition:
ThreadSafeOutputFileStream.cc:7
edm::ThreadSafeOutputFileStream::file_
std::ofstream file_
Definition:
ThreadSafeOutputFileStream.h:20
tmp
std::vector< std::vector< double > > tmp
Definition:
MVATrainer.cc:100
edm::ThreadSafeOutputFileStream::~ThreadSafeOutputFileStream
~ThreadSafeOutputFileStream()
Definition:
ThreadSafeOutputFileStream.cc:11
edm::ThreadSafeOutputFileStream::write
void write(std::string &&msg)
Definition:
ThreadSafeOutputFileStream.cc:21
Generated for CMSSW Reference Manual by
1.8.5