Main Page
Namespaces
Classes
Package Documentation
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
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
) : file_{name} {}
8
9
ThreadSafeOutputFileStream::~ThreadSafeOutputFileStream
() {
10
std::string
tmp
;
11
while
(
waitingMessages_
.try_pop(tmp)) {
12
file_
<<
tmp
;
13
}
14
file_
.close();
15
}
16
17
void
ThreadSafeOutputFileStream::write
(
std::string
&&
msg
) {
18
waitingMessages_
.push(
std::move
(
msg
));
19
bool
expected{
false
};
20
if
(
msgBeingLogged_
.compare_exchange_strong(expected,
true
)) {
21
std::string
tmp
;
22
while
(
waitingMessages_
.try_pop(tmp)) {
23
file_
<<
tmp
;
24
}
25
msgBeingLogged_
.store(
false
);
26
}
27
}
28
}
// namespace edm
ThreadSafeOutputFileStream.h
mergeVDriftHistosByStation.name
string name
Definition:
mergeVDriftHistosByStation.py:78
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:256
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:511
edm::ThreadSafeOutputFileStream::ThreadSafeOutputFileStream
ThreadSafeOutputFileStream(std::string const &name)
Definition:
ThreadSafeOutputFileStream.cc:7
edm::ThreadSafeOutputFileStream::file_
std::ofstream file_
Definition:
ThreadSafeOutputFileStream.h:20
mps_check.msg
tuple msg
Definition:
mps_check.py:285
edm::ThreadSafeOutputFileStream::~ThreadSafeOutputFileStream
~ThreadSafeOutputFileStream()
Definition:
ThreadSafeOutputFileStream.cc:9
createJobs.tmp
tmp
align.sh
Definition:
createJobs.py:716
edm::ThreadSafeOutputFileStream::write
void write(std::string &&msg)
Definition:
ThreadSafeOutputFileStream.cc:17
Generated for CMSSW Reference Manual by
1.8.5