Kouhei Sutou
null+****@clear*****
Sun Apr 19 16:06:06 JST 2015
Kouhei Sutou 2015-04-19 16:06:06 +0900 (Sun, 19 Apr 2015) New Revision: d18c2837f09a611e86ae1c0c82874be86db465af https://github.com/groonga/groonga/commit/d18c2837f09a611e86ae1c0c82874be86db465af Message: select: expand macro Because Visual C++ doesn't support `ifdef` in macro. Modified files: lib/com.c Modified: lib/com.c (+18 -5) =================================================================== --- lib/com.c 2015-04-19 15:10:35 +0900 (9d64704) +++ lib/com.c 2015-04-19 16:06:06 +0900 (eb1cacf) @@ -560,13 +560,26 @@ grn_com_event_poll(grn_ctx *ctx, grn_com_event *ev, int timeout) FD_ZERO(&wfds); ctx->errlvl = GRN_OK; ctx->rc = GRN_SUCCESS; - GRN_HASH_EACH(ctx, ev->hash, eh, &pfd, &dummy, &com, { - if ((com->events & GRN_COM_POLLIN)) { FD_SET(*pfd, &rfds); } - if ((com->events & GRN_COM_POLLOUT)) { FD_SET(*pfd, &wfds); } + { + grn_hash_cursor *cursor; + cursor = grn_hash_cursor_open(ctx, ev->hash, NULL, 0, NULL, 0, 0, -1, 0); + if (cursor) { + grn_id id; + while ((id = grn_hash_cursor_next(ctx, cursor))) { + grn_hash_cursor_get_key_value(ctx, + cursor, + (void **)(&pfd), + &dummy, + (void **)(&com)); + if ((com->events & GRN_COM_POLLIN)) { FD_SET(*pfd, &rfds); } + if ((com->events & GRN_COM_POLLOUT)) { FD_SET(*pfd, &wfds); } # ifndef WIN32 - if (*pfd > nfds) { nfds = *pfd; } + if (*pfd > nfds) { nfds = *pfd; } # endif /* WIN32 */ - }); + } + grn_hash_cursor_close(ctx, cursor); + } + } nevents = select(nfds + 1, &rfds, &wfds, NULL, (timeout >= 0) ? &tv : NULL); if (nevents < 0) { SOERR("select"); -------------- next part -------------- HTML����������������������������... Download