|
JH-Toolkit v1.4.1
An engineering-oriented C++20 toolkit with duck-typed concepts, static design, async coroutines, and semantic containers — header-only, RTTI-free, and concurrency-friendly.
|
Synchronization domain managing timed mutex acquisition and binding exactly one slot. More...
#include <jh/asynchronous/slot.h>
Public Member Functions | |
| slot_hub (std::chrono::milliseconds t) | |
| Construct a slot_hub with a timeout. | |
| void | bind_slot (slot &s) noexcept |
| Bind a slot coroutine to this hub. | |
| template<typename T> | |
| listener< T > | make_listener () noexcept |
| Create a new listener bound to this slot_hub. | |
Friends | |
| template<typename T> | |
| class | listener |
| Grants listener<T> access to internal slot. | |
Synchronization domain managing timed mutex acquisition and binding exactly one slot.
A slot_hub is not just a synchronizer; it's also a factory for listeners and a creator of topologies. It allows slots and listeners to be constructed separately but bound to the same scope.
A slot_hub defines:
std::timed_mutex. slot. slot (under the same lock). make_listener. slot_hub performs no buffering. Every event is either: fully delivered (value written + slot resumed) or completely rejected.slot may be bound to a hub. Binding multiple slots is wrong.
|
inlineexplicit |
Construct a slot_hub with a timeout.
Initializes the internal timed mutex and sets the delivery timeout window.
| t | Timeout duration for acquiring the lock during emit. |
|
inlinenoexcept |
Bind a slot coroutine to this hub.
Associates a single slot coroutine with this synchronization domain.
| s | Reference to the slot to bind. |
|
inlinenoexcept |
Create a new listener bound to this slot_hub.
The listener will share the hub's timeout and mutex context.
| T | Type of payload the listener will receive. |