src
HeterogeneousCore
SonicCore
interface
SonicDispatcherPseudoAsync.h
Go to the documentation of this file.
1
#ifndef HeterogeneousCore_SonicCore_SonicDispatcherPseudoAsync
2
#define HeterogeneousCore_SonicCore_SonicDispatcherPseudoAsync
3
4
#include "
HeterogeneousCore/SonicCore/interface/SonicDispatcher.h
"
5
6
#include <memory>
7
#include <condition_variable>
8
#include <mutex>
9
#include <thread>
10
#include <atomic>
11
#include <exception>
12
13
class
SonicClientBase
;
14
15
//pretend to be async + non-blocking by waiting for blocking calls to return in separate std::thread
16
class
SonicDispatcherPseudoAsync
:
public
SonicDispatcher
{
17
public
:
18
//constructor
19
SonicDispatcherPseudoAsync
(
SonicClientBase
*
client
);
20
21
//destructor
22
~SonicDispatcherPseudoAsync
()
override
;
23
24
//main operation
25
void
dispatch
(
edm::WaitingTaskWithArenaHolder
holder)
override
;
26
27
private
:
28
void
waitForNext
();
29
30
//members
31
bool
hasCall_
;
32
std::mutex
mutex_
;
33
std::condition_variable
cond_
;
34
std::atomic<bool>
stop_
;
35
std::unique_ptr<std::thread>
thread_
;
36
};
37
38
#endif
SonicDispatcherPseudoAsync::cond_
std::condition_variable cond_
Definition:
SonicDispatcherPseudoAsync.h:33
HLTObjectMonitor_Client_cff.client
client
Definition:
HLTObjectMonitor_Client_cff.py:6
SonicDispatcherPseudoAsync::thread_
std::unique_ptr< std::thread > thread_
Definition:
SonicDispatcherPseudoAsync.h:35
mutex
static std::mutex mutex
Definition:
Proxy.cc:8
SonicClientBase
Definition:
SonicClientBase.h:18
edm::WaitingTaskWithArenaHolder
Definition:
WaitingTaskWithArenaHolder.h:34
SonicDispatcherPseudoAsync::mutex_
std::mutex mutex_
Definition:
SonicDispatcherPseudoAsync.h:32
SonicDispatcherPseudoAsync::SonicDispatcherPseudoAsync
SonicDispatcherPseudoAsync(SonicClientBase *client)
Definition:
SonicDispatcherPseudoAsync.cc:5
SonicDispatcher::dispatch
virtual void dispatch()
Definition:
SonicDispatcher.cc:9
SonicDispatcher.h
SonicDispatcher
Definition:
SonicDispatcher.h:8
SonicDispatcherPseudoAsync::stop_
std::atomic< bool > stop_
Definition:
SonicDispatcherPseudoAsync.h:34
SonicDispatcherPseudoAsync::waitForNext
void waitForNext()
Definition:
SonicDispatcherPseudoAsync.cc:35
SonicDispatcherPseudoAsync::~SonicDispatcherPseudoAsync
~SonicDispatcherPseudoAsync() override
Definition:
SonicDispatcherPseudoAsync.cc:10
SonicDispatcherPseudoAsync
Definition:
SonicDispatcherPseudoAsync.h:16
SonicDispatcherPseudoAsync::hasCall_
bool hasCall_
Definition:
SonicDispatcherPseudoAsync.h:31
Generated for CMSSW Reference Manual by
1.8.14