OpenCBDC Transaction Processor
|
Waits on a group of blocking sockets to be ready for read operations. More...
#include <socket_selector.hpp>
Public Member Functions | |
socket_selector ()=default | |
Constructs an empty socket selector. | |
~socket_selector () | |
socket_selector (const socket_selector &)=delete | |
auto | operator= (const socket_selector &) -> socket_selector &=delete |
socket_selector (socket_selector &&)=delete | |
auto | operator= (socket_selector &&) -> socket_selector &=delete |
auto | init () -> bool |
Sets-up the socket selector. | |
auto | add (const socket &sock) -> bool |
Adds a socket to the selector so that it is checked for events after a call to wait. | |
auto | wait () -> bool |
Blocks until at least one socket in the selector is ready to perform a read operation. | |
void | unblock () |
Unblocks a blocked wait() call. | |
Waits on a group of blocking sockets to be ready for read operations.
Utility class for waiting on multiple blocking sockets. Users add sockets to the selector and block on a wait call. The call unblocks when any of the sockets in the selector are ready to receive data.
Definition at line 21 of file socket_selector.hpp.
|
default |
Constructs an empty socket selector.
cbdc::network::socket_selector::~socket_selector | ( | ) |
Definition at line 67 of file socket_selector.cpp.
References unblock().
|
delete |
|
delete |
auto cbdc::network::socket_selector::add | ( | const socket & | sock | ) | -> bool |
Adds a socket to the selector so that it is checked for events after a call to wait.
sock | the socket to add to the selector |
Definition at line 12 of file socket_selector.cpp.
auto cbdc::network::socket_selector::init | ( | ) | -> bool |
Sets-up the socket selector.
Must be called before the selector is used.
Definition at line 49 of file socket_selector.cpp.
|
delete |
|
delete |
void cbdc::network::socket_selector::unblock | ( | ) |
Unblocks a blocked wait() call.
Definition at line 58 of file socket_selector.cpp.
Referenced by cbdc::network::connection_manager::close(), and ~socket_selector().
auto cbdc::network::socket_selector::wait | ( | ) | -> bool |
Blocks until at least one socket in the selector is ready to perform a read operation.
Definition at line 16 of file socket_selector.cpp.