wex
v21.04.0
|
This class offers a templatized queue you can put events in, and a thread pool that retrieves the events and publishes them through the event handler. More...
#include <wex/queue-thread.h>
Classes | |
class | event_handler |
This event handler class must be subclassed and passed in to the queue thread constructor (in order to process events of type E). More... | |
Public Member Functions | |
queue_thread (event_handler &event_handler_instance, unsigned int timeout_ms=500) | |
Constructor. More... | |
virtual | ~queue_thread () |
Destructor. | |
void | emplace (std::unique_ptr< E > &event) |
Emplaces event on the queue. More... | |
bool | empty () |
Returns true if queue is empty. | |
bool | is_running () const |
Returns true if event loop is started. | |
void | stop () |
Stops the threads (and processing of events). | |
This class offers a templatized queue you can put events in, and a thread pool that retrieves the events and publishes them through the event handler.
Type E is the type of event to be processed
|
inline |
Constructor.
event_handler_instance | event handler |
timeout_ms | timeout im milliseconds used |
|
inline |
Emplaces event on the queue.
The thread pool takes care of reading and clearing the queue, and sending it to the event handler (be sure you have invoked start).