|
wex v24.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/core/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 T). More... | |
Public Member Functions | |
| queue_thread (event_handler &event_handler_instance, unsigned int timeout_ms=500) | |
| Constructor. | |
| void | emplace (std::unique_ptr< T > &event) |
| Emplaces event on the queue. | |
| bool | empty () const |
| 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 T is the type of event to be processed
| wex::queue_thread< T >::queue_thread | ( | event_handler & | event_handler_instance, |
| unsigned int | timeout_ms = 500 ) |
Constructor.
| event_handler_instance | event handler |
| timeout_ms | timeout im milliseconds used |
| void wex::queue_thread< T >::emplace | ( | std::unique_ptr< T > & | event | ) |
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).