Template class for running the specified function on the queue items in a separate thread.
Container | The container class for the queue, e.g. std::queue, std::list. |
Definition at line 287 of file infer_utils.h.
Public Types | |
using | Item = typename Container::value_type |
using | RunFunc = std::function< bool(Item)> |
Public Member Functions | |
QueueThread (RunFunc runFunc, const std::string &name) | |
Create a new thread that runs the specified function over the queued items in a loop. More... | |
void | setThreadName (const std::string &name) |
Set the internal (m_Name) name of the thread and system name using pthread_setname_np(). More... | |
~QueueThread () | |
Destructor. More... | |
void | join () |
bool | queueItem (Item item) |
Add an item to the queue for processing. More... | |
using INFER_EXPORT_API::QueueThread< Container >::Item = typename Container::value_type |
Definition at line 289 of file infer_utils.h.
using INFER_EXPORT_API::QueueThread< Container >::RunFunc = std::function<bool(Item)> |
Definition at line 290 of file infer_utils.h.
|
inline |
Create a new thread that runs the specified function over the queued items in a loop.
[in] | runFunc | The processing function of the thread. |
[in] | name | Name for the thread. |
Definition at line 299 of file infer_utils.h.
References InferDebug.
|
inline |
Destructor.
Send a wake up trigger to the queue, wait for the thread to join and clear the queue.
Definition at line 333 of file infer_utils.h.
|
inline |
Definition at line 334 of file infer_utils.h.
References InferDebug, and INFER_EXPORT_API::safeStr().
|
inline |
Add an item to the queue for processing.
Definition at line 345 of file infer_utils.h.
|
inline |
Set the internal (m_Name) name of the thread and system name using pthread_setname_np().
Definition at line 314 of file infer_utils.h.
References InferDebug, InferError, and INFER_EXPORT_API::safeStr().