+#if USE_POLL
+ yaz_log (LOG_LOG, "poll start");
+ r = poll (pollfds, nfds, 15000);
+ yaz_log (LOG_LOG, "poll stop, returned r=%d", r);
+ for (i = 0; i<nfds; i++)
+ {
+ Z3950_connection c = poll_cs[i];
+ if (r && c->mask)
+ {
+ int mask = 0;
+ if (pollfds[i].revents & POLLIN)
+ mask += Z3950_SELECT_READ;
+ if (pollfds[i].revents & POLLOUT)
+ mask += Z3950_SELECT_WRITE;
+ if (pollfds[i].revents & POLLERR)
+ mask += Z3950_SELECT_EXCEPT;
+ if (mask)
+ Z3950_connection_do_io(c, mask);
+ }
+ else if (r == 0 && c->mask)
+ {
+ /* timeout and this connection was waiting */
+ c->error = Z3950_ERROR_TIMEOUT;
+ c->event_pending = 1;
+ }
+ }
+#else