CIRCT  20.0.0git
Public Member Functions | Private Member Functions | Private Attributes | List of all members
esi::AcceleratorServiceThread::Impl Struct Reference
Collaboration diagram for esi::AcceleratorServiceThread::Impl:
Collaboration graph
[legend]

Public Member Functions

 Impl ()
 
void start ()
 
void stop ()
 
void addListener (std::initializer_list< ReadChannelPort * > listenPorts, std::function< void(ReadChannelPort *, MessageData)> callback)
 When there's data on any of the listenPorts, call the callback. More...
 
void addTask (std::function< void(void)> task)
 

Private Member Functions

void loop ()
 

Private Attributes

volatile bool shutdown = false
 
std::thread me
 
std::mutex m
 
std::map< ReadChannelPort *, std::pair< std::function< void(ReadChannelPort *, MessageData)>, std::future< MessageData > > > listeners
 
std::vector< std::function< void(void)> > taskList
 Tasks which should be called on every loop iteration. More...
 

Detailed Description

Definition at line 252 of file Accelerator.cpp.

Constructor & Destructor Documentation

◆ Impl()

esi::AcceleratorServiceThread::Impl::Impl ( )
inline

Definition at line 253 of file Accelerator.cpp.

Member Function Documentation

◆ addListener()

void esi::AcceleratorServiceThread::Impl::addListener ( std::initializer_list< ReadChannelPort * >  listenPorts,
std::function< void(ReadChannelPort *, MessageData)>  callback 
)

When there's data on any of the listenPorts, call the callback.

This method can be called from any thread.

Definition at line 336 of file Accelerator.cpp.

◆ addTask()

void esi::AcceleratorServiceThread::Impl::addTask ( std::function< void(void)>  task)
inline

Definition at line 265 of file Accelerator.cpp.

References m, and taskList.

◆ loop()

void esi::AcceleratorServiceThread::Impl::loop ( )
private

Definition at line 288 of file Accelerator.cpp.

References assert(), listeners, m, shutdown, and taskList.

Referenced by start().

◆ start()

void esi::AcceleratorServiceThread::Impl::start ( )
inline

Definition at line 254 of file Accelerator.cpp.

References loop(), and me.

◆ stop()

void esi::AcceleratorServiceThread::Impl::stop ( )
inline

Definition at line 255 of file Accelerator.cpp.

References me, and shutdown.

Member Data Documentation

◆ listeners

std::map<ReadChannelPort *, std::pair<std::function<void(ReadChannelPort *, MessageData)>, std::future<MessageData> > > esi::AcceleratorServiceThread::Impl::listeners
private

Definition at line 282 of file Accelerator.cpp.

Referenced by loop().

◆ m

std::mutex esi::AcceleratorServiceThread::Impl::m
private

Definition at line 276 of file Accelerator.cpp.

Referenced by addTask(), and loop().

◆ me

std::thread esi::AcceleratorServiceThread::Impl::me
private

Definition at line 273 of file Accelerator.cpp.

Referenced by start(), and stop().

◆ shutdown

volatile bool esi::AcceleratorServiceThread::Impl::shutdown = false
private

Definition at line 272 of file Accelerator.cpp.

Referenced by loop(), and stop().

◆ taskList

std::vector<std::function<void(void)> > esi::AcceleratorServiceThread::Impl::taskList
private

Tasks which should be called on every loop iteration.

Definition at line 285 of file Accelerator.cpp.

Referenced by addTask(), and loop().


The documentation for this struct was generated from the following file: