1
0
Fork 0
mirror of https://gitlab.com/niansa/libcrosscoro.git synced 2025-03-06 20:53:32 +01:00
libcrosscoro/inc/coro/poll.hpp
Josh Baldwin c02aefe26e
libc-ares dns client for hostname -> ip addres lookups (#24)
* libc-ares dns client for hostname -> ip addres lookups

* Add tcp_client dns lookup if hostname + dns available
2020-12-29 17:19:26 -07:00

39 lines
814 B
C++

#pragma once
#include <sys/epoll.h>
namespace coro
{
enum class poll_op : uint64_t
{
/// Poll for read operations.
read = EPOLLIN,
/// Poll for write operations.
write = EPOLLOUT,
/// Poll for read and write operations.
read_write = EPOLLIN | EPOLLOUT
};
inline auto poll_op_readable(poll_op op) -> bool
{
return (static_cast<uint64_t>(op) & EPOLLIN);
}
inline auto poll_op_writeable(poll_op op) -> bool
{
return (static_cast<uint64_t>(op) & EPOLLOUT);
}
enum class poll_status
{
/// The poll operation was was successful.
event,
/// The poll operation timed out.
timeout,
/// The file descriptor had an error while polling.
error,
/// The file descriptor has been closed by the remote or an internal error/close.
closed
};
} // namespace coro