Instrument Neutral Distributed Interface INDI
2.0.2
|
#include <indisinglethreadpool.h>
Public Member Functions | |
SingleThreadPool () | |
~SingleThreadPool () | |
void | start (const std::function< void(const std::atomic_bool &isAboutToClose)> &functionToRun) |
Reserves a thread and uses it to run functionToRun. A running function can check the 'isAboutToClose' flag and decide whether to end the work and give the thread. More... | |
bool | tryStart (const std::function< void(const std::atomic_bool &isAboutToClose)> &functionToRun) |
If thread isn't available at the time of calling, then this function does nothing and returns false. Otherwise, functionToRun is run immediately using thread and this function returns true. More... | |
void | quit () |
Sets the 'isAboutToClose' flag to 'true' and waits for the end of running function. More... | |
Protected Attributes | |
std::shared_ptr< SingleThreadPoolPrivate > | d_ptr |
Definition at line 29 of file indisinglethreadpool.h.
INDI::SingleThreadPool::SingleThreadPool | ( | ) |
Definition at line 64 of file indisinglethreadpool.cpp.
INDI::SingleThreadPool::~SingleThreadPool | ( | ) |
Definition at line 68 of file indisinglethreadpool.cpp.
void INDI::SingleThreadPool::quit | ( | ) |
Sets the 'isAboutToClose' flag to 'true' and waits for the end of running function.
Definition at line 102 of file indisinglethreadpool.cpp.
void INDI::SingleThreadPool::start | ( | const std::function< void(const std::atomic_bool &isAboutToClose)> & | functionToRun | ) |
Reserves a thread and uses it to run functionToRun. A running function can check the 'isAboutToClose' flag and decide whether to end the work and give the thread.
Definition at line 71 of file indisinglethreadpool.cpp.
bool INDI::SingleThreadPool::tryStart | ( | const std::function< void(const std::atomic_bool &isAboutToClose)> & | functionToRun | ) |
If thread isn't available at the time of calling, then this function does nothing and returns false. Otherwise, functionToRun is run immediately using thread and this function returns true.
Definition at line 84 of file indisinglethreadpool.cpp.
|
protected |
Definition at line 50 of file indisinglethreadpool.h.