beforepoll_fn *before;
afterpoll_fn *after;
void *state;
- int32_t max_nfds;
int32_t nfds;
cstring_t desc;
LIST_ENTRY(poll_interest) entry;
}
void register_for_poll(void *st, beforepoll_fn *before,
- afterpoll_fn *after, int32_t max_nfds, cstring_t desc)
+ afterpoll_fn *after, cstring_t desc)
{
struct poll_interest *i;
i->before=before;
i->after=after;
i->state=st;
- i->max_nfds=max_nfds;
i->nfds=0;
i->desc=desc;
LIST_INSERT_HEAD(®, i, entry);
static void run(void)
{
struct poll_interest *i;
- int rv, nfds, remain, idx;
+ int rv, nfds, idx;
int timeout;
struct pollfd *fds=0;
int allocdfds=0, shortfall=0;
allocdfds += shortfall;
fds=safe_realloc_ary(fds,sizeof(*fds),allocdfds, "run");
}
- remain=allocdfds;
shortfall=0;
idx=0;
timeout=-1;
LIST_FOREACH(i, ®, entry) {
+ int remain=allocdfds-idx;
nfds=remain;
rv=i->before(i->state, fds+idx, &nfds, &timeout);
if (rv!=0) {
i->desc,timeout);
}
idx+=nfds;
- remain-=nfds;
i->nfds=nfds;
}
do {