MEDIUM: fd: add fd_poll_{recv,send} for use when explicit polling is required
The old EV_FD_SET() macro was confusing, as it would enable receipt but there
was no way to indicate that EAGAIN was received, hence the recently added
FD_WAIT_* flags. They're not enough as we're still facing a conflict between
EV_FD_* and FD_WAIT_*. So let's offer I/O functions what they need to explicitly
request polling.
diff --git a/include/proto/fd.h b/include/proto/fd.h
index 072d3f6..bfce120 100644
--- a/include/proto/fd.h
+++ b/include/proto/fd.h
@@ -83,6 +83,11 @@
cur_poller.clr(fd, DIR_RD);
}
+static inline void fd_poll_recv(int fd)
+{
+ cur_poller.wai(fd, DIR_RD);
+}
+
static inline void fd_want_send(int fd)
{
cur_poller.set(fd, DIR_WR);
@@ -93,6 +98,11 @@
cur_poller.clr(fd, DIR_WR);
}
+static inline void fd_poll_send(int fd)
+{
+ cur_poller.wai(fd, DIR_WR);
+}
+
static inline void fd_stop_both(int fd)
{
cur_poller.rem(fd);
diff --git a/include/types/fd.h b/include/types/fd.h
index 2e350b8..c6e47f2 100644
--- a/include/types/fd.h
+++ b/include/types/fd.h
@@ -100,6 +100,7 @@
int REGPRM2 (*is_set)(const int fd, int dir); /* check if <fd> is being polled for dir <dir> */
void REGPRM2 (*set)(const int fd, int dir); /* set polling on <fd> for <dir> */
void REGPRM2 (*clr)(const int fd, int dir); /* clear polling on <fd> for <dir> */
+ void REGPRM2 (*wai)(const int fd, int dir); /* wait for polling on <fd> for <dir> */
void REGPRM1 (*rem)(const int fd); /* remove any polling on <fd> */
void REGPRM1 (*clo)(const int fd); /* mark <fd> as closed */
void REGPRM2 (*poll)(struct poller *p, int exp); /* the poller itself */