14#if defined(ZTH_HAVE_POLLER) && !defined(ZTH_OS_WINDOWS)
24ssize_t
read(
int fd,
void* buf,
size_t count)
28 int flags = fcntl(fd, F_GETFL);
33 if((flags & O_NONBLOCK)) {
36 return ::read(fd, buf, count);
45 return ::read(fd, buf, count);
52ssize_t
write(
int fd,
void const* buf,
size_t count)
56 int flags = fcntl(fd, F_GETFL);
61 if((flags & O_NONBLOCK)) {
64 return ::write(fd, buf, count);
73 return ::write(fd, buf, count);
79static int no_io __attribute__((unused));
Fiber & currentFiber() noexcept
Return the currently executing fiber.
ssize_t read(int fd, void *buf, size_t count)
Like normal read(), but forwards the poll() to the zth::Waiter in case it would block.
ssize_t write(int fd, void const *buf, size_t count)
Like normal write(), but forwards the poll() to the zth::Waiter in case it would block.
int poll(P pollable, int timeout_ms=-1)
Fiber-aware poll() for a single pollable thing.
#define zth_dbg(group, fmt, a...)
Debug printf()-like function.
cow_string str(T value)
Returns an zth::string representation of the given value.
void perf_syscall(char const *syscall, Timestamp const &t=Timestamp())
Put a syscall into the perf output.
A pollable file descriptor.
static const unsigned long PollIn
static const unsigned long PollOut
#define unlikely(expr)
Marks the given expression to likely be evaluated to true.