X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Feventl.c;h=b914bf3914551dd1ffd632b838e1754227887fd6;hb=19b85891163749971c8e15f9ccca76cc4c5bb9bc;hp=f0c51dfa45530833738341ae44c5421af95fd1ce;hpb=1373a0c2c322486d75db877710d63f94b7c30634;p=pazpar2-moved-to-github.git diff --git a/src/eventl.c b/src/eventl.c index f0c51df..b914bf3 100644 --- a/src/eventl.c +++ b/src/eventl.c @@ -36,14 +36,9 @@ #include #include -#ifdef WIN32 -#include -#else +#if HAVE_UNISTD_H #include #endif -#if HAVE_SYS_TIME_H -#include -#endif #include #include @@ -258,6 +253,7 @@ static int event_loop(iochan_man_t man, IOCHAN *iochans) } for (p = start; p; p = p->next, i++) { + p->poll_offset = i; fds[i].client_data = p; fds[i].fd = p->fd; fds[i].input_mask = 0; @@ -287,9 +283,9 @@ static int event_loop(iochan_man_t man, IOCHAN *iochans) return 0; } } - i = 0; if (man->sel_fd != -1) { + i = 0; assert(fds[i].fd == man->sel_fd); if (fds[i].output_mask) { @@ -305,7 +301,6 @@ static int event_loop(iochan_man_t man, IOCHAN *iochans) chan->thread_users--; } } - i++; } if (man->log_level) { @@ -314,10 +309,10 @@ static int event_loop(iochan_man_t man, IOCHAN *iochans) no++; yaz_log(man->log_level, "%d channels", no); } - for (; i < no_fds; i++) + for (p = start; p; p = p->next) { time_t now = time(0); - p = fds[i].client_data; + i = p->poll_offset; if (p->destroyed) { @@ -400,18 +395,6 @@ void iochan_man_events(iochan_man_t man) event_loop(man, &man->channel_list); } -void pazpar2_sleep(double d) -{ -#ifdef WIN32 - Sleep( (DWORD) (d * 1000)); -#else - struct timeval tv; - tv.tv_sec = floor(d); - tv.tv_usec = (d - floor(d)) * 1000000; - select(0, 0, 0, 0, &tv); -#endif -} - /* * Local variables: * c-basic-offset: 4