Thread-friendly blocking channel for sending packets.
More...
#include <channel.h>
Thread-friendly blocking channel for sending packets.
◆ PacketChannel()
yarilo::PacketChannel::PacketChannel |
( |
| ) |
|
|
inline |
Constructor for the packet channel
◆ close()
void yarilo::PacketChannel::close |
( |
| ) |
|
|
inline |
Close the channel and notify all blocked subscribers
◆ is_closed()
bool yarilo::PacketChannel::is_closed |
( |
| ) |
|
|
inline |
Get the channels closed state
- Returns
- True if the channel is closed
◆ is_empty()
bool yarilo::PacketChannel::is_empty |
( |
| ) |
|
|
inline |
Get the channels queue emptiness state
- Returns
- True if the packet queue is empty
◆ len()
size_t yarilo::PacketChannel::len |
( |
| ) |
|
|
inline |
Get the queue length
- Returns
- Number of packets waiting in the queue
◆ lock_send()
std::unique_lock< std::mutex > yarilo::PacketChannel::lock_send |
( |
| ) |
|
|
inline |
Lock the queue for sending, useful for making sure that packets will not come in a critical section
- Returns
- Unique lock of the mutex
◆ receive()
std::optional< std::unique_ptr< Tins::Packet > > yarilo::PacketChannel::receive |
( |
| ) |
|
|
inline |
Receive a packet from the channel, blocks until a packet arrives, or the channel is closed
- Returns
- Packet or nullopt in the case of a channel close
◆ send()
void yarilo::PacketChannel::send |
( |
std::unique_ptr< Tins::Packet > | pkt | ) |
|
|
inline |
Send a packet through the channel
- Parameters
-
[in] | pkt | Packet packet to send |
◆ unlock_send()
void yarilo::PacketChannel::unlock_send |
( |
| ) |
|
|
inline |
Unlock the queue for sending, useful for making sure that packets will not come in a critical section
The documentation for this class was generated from the following file:
- /tmp/nix-build-Yarilo-0.9.9.drv-0/backend/src/channel.h