Main Page
Namespaces
Classes
Package Documentation
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
}
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:255
ThreadSafeOutputFileStream.h
edm::ThreadSafeOutputFileStream::waitingMessages_
tbb::concurrent_queue< std::string > waitingMessages_
Definition:
ThreadSafeOutputFileStream.h:22
mps_alisetup.msg
tuple msg
Definition:
mps_alisetup.py:509
edm::ThreadSafeOutputFileStream::msgBeingLogged_
std::atomic< bool > msgBeingLogged_
Definition:
ThreadSafeOutputFileStream.h:21
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
HLT enums.
Definition:
AlignableModifier.h:17
edm::ThreadSafeOutputFileStream::~ThreadSafeOutputFileStream
~ThreadSafeOutputFileStream()
Definition:
ThreadSafeOutputFileStream.cc:11
dataset.name
name
Definition:
dataset.py:45
edm::ThreadSafeOutputFileStream::write
void write(std::string &&msg)
Definition:
ThreadSafeOutputFileStream.cc:21
eostools.move
def move(src, dest)
Definition:
eostools.py:510
Generated for CMSSW Reference Manual by
1.8.11