Asynchronous I/O for C++. More...
Classes | |
class | acceptor |
Accept incoming stream connections on a local network port. More... | |
class | core |
Asynchronous interface to socket I/O, time events, and DNS. More... | |
class | system_error |
Base exception class for all operating system errors. More... | |
class | signal_block |
Block all POSIX signals for the current scope. More... | |
class | system_socket |
Primary interface to system sockets. More... | |
Typedefs | |
typedef unsigned int | seconds_t |
An (unsigned) quantity of seconds. | |
typedef ::iovec | iovec |
The native type used for scatter/gather I/O. | |
typedef int | native_socket_t |
The system's native socket type. | |
typedef std::time_t | time_t |
The current time of day, represented in seconds since 1970-01-01 00:00:00 UTC. | |
typedef ::timeval | timeval |
The current time of day in microseconds since 1970-01-01 00:00:00 UTC. | |
Functions | |
template<class Result , class Predicate , class Action > | |
Result | throw_errno_if (Predicate is_failure, std::string const &error_msg, Action f) |
Safety-wrapper for calling POSIX system functions. | |
template<class Predicate , class Action > | |
Action::result_type | throw_errno_if (Predicate const &is_failure, std::string const &error_msg, Action const &f) |
Overloaded variant that automatically deduces the return type. | |
template<class Num , class Action > | |
Num | throw_errno_if_minus1 (std::string const &error_msg, Action const &f) |
Specialized version of throw_errno_if() for system calls that return -1 on error. | |
template<class Action > | |
Action::result_type | throw_errno_if_minus1 (std::string const &error_msg, Action const &f) |
Overloaded variant that automatically deduces the return type. | |
void | reset (iovec &iov, char const *b, char const *e) |
Set an iovec to the given byte range. | |
iovec | make_iovec (char const *b, char const *e) |
Construct ioxx::iovec using an iterator range. |
Asynchronous I/O for C++.
typedef unsigned int ioxx::seconds_t |
An (unsigned) quantity of seconds.
This type is useful for specifying time durations, i.e. timeouts that will occur at some point in the future.
typedef ::timeval ioxx::timeval |
The current time of day in microseconds since 1970-01-01 00:00:00 UTC.
POSIX.1-2001 defines this type to contain (at least) the following members:
The type suseconds_t
is usually signed for history reasons (it used to be a long
).
Result ioxx::throw_errno_if | ( | Predicate | is_failure, | |
std::string const & | error_msg, | |||
Action | f | |||
) |
Safety-wrapper for calling POSIX system functions.
Pretty much all system functions may fail with the EINTR
condition, meaning that the call was interrupted by a signal. The throw_errno_if() combinator handles this problem transparently and restarts the function if that condition arises. All other errors will be signaled by means of a system_error exception.
is_failure | Predicate of type bool (Result) that returns true if the returned value constitutes an error. | |
error_msg | Context string to be used when constructing a system_error in case of an error. | |
f | Functor of type Result () that performs the desired system call. |
f
. system_error | Thrown if the is_failure predicate returns true . |
Num ioxx::throw_errno_if_minus1 | ( | std::string const & | error_msg, | |
Action const & | f | |||
) |
Specialized version of throw_errno_if() for system calls that return -1 on error.
This combinator removes the need to specify an is_failure
predicate.
error_msg | Context string to be used when constructing a system_error in case of an error. | |
f | Functor of type Num () that performs the desired system call. |
f
. system_error | Thrown if the is_failure predicate returns true . |