25 constexpr
int eintr_maximum_attempts =100;
26 #define HANDLE_EINTR_EAGAIN(x) ({ \
27 unsigned char _attempts = 0; \
29 decltype(x) _result; \
35 while (_result == -1 \
36 && (errno == EINTR || \
38 errno == EWOULDBLOCK) \
39 && _attempts++ < eintr_maximum_attempts); \
44 constexpr
int PIPE_LISTEN = 0, PIPE_WRITE = 1;
45 typedef void (*PipeSourceCallback)(
void* ctx);
47 GSource*
pipe_source_new(
int pipefd[2], PipeSourceCallback cb,
void* ctx);
49 #endif // GLIB_TOOLS_H