|
CppZmqZoltanExt 0.0.1
|
Event loop for managing sockets and timers. More...
#include <chrono>#include <cstddef>#include <functional>#include <list>#include <map>#include <zmq.hpp>#include "cppzmqzoltanext/czze_export.h"#include "poller.h"

Go to the source code of this file.
Classes | |
| class | zmqzext::loop_t |
| Event loop for managing socket and timer events. More... | |
Typedefs | |
| using | zmqzext::timer_id_t = std::size_t |
| Unique identifier for timer instances. | |
| using | zmqzext::fn_socket_handler_t = std::function< bool(loop_t &, zmq::socket_ref)> |
| Socket event handler callback type. | |
| using | zmqzext::fn_timer_handler_t = std::function< bool(loop_t &, timer_id_t)> |
| Timer event handler callback type. | |
Event loop for managing sockets and timers.
This header provides the loop_t class, which implements a complete event loop for managing socket I/O and timer-based events. The event loop combines socket polling (via poller_t) with timer management to create a reactive event-driven architecture.
The event loop monitors registered sockets for readiness and fires callbacks when sockets become ready. Timers can be registered to trigger callbacks at specified intervals, either once or repeatedly. This enables building complex applications with concurrent I/O operations and time-based scheduling.
Key features:
Distributed under the MIT License (MIT) (See accompanying file LICENSE or copy at http://opensource.org/licenses/MIT)
Definition in file loop.h.
| using zmqzext::fn_socket_handler_t = typedef std::function<bool(loop_t&, zmq::socket_ref)> |
Socket event handler callback type.
Function signature for socket event handlers. The handler is called when a registered socket becomes ready for receiving. Returning false finishes the loop; returning true continues processing.
| loop | Reference to the event loop |
| socket | The socket that is ready for receiving |
| using zmqzext::fn_timer_handler_t = typedef std::function<bool(loop_t&, timer_id_t)> |
Timer event handler callback type.
Function signature for timer event handlers. The handler is called when a registered timer expires. Returning false finishes the loop; returning true continues processing.
| loop | Reference to the event loop |
| timer_id | The unique identifier of the timer that expired |
| using zmqzext::timer_id_t = typedef std::size_t |