X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=lib%2Fpoll-loop.c;h=510903e46c9677d2dccbb8f171b017fa0cc0333a;hb=55489d31a66b39aa7b41ed07a19f0bd7d7fbdd11;hp=abd44d1be709c8c902302011a26a2c9f30f84f3f;hpb=7daaec4e04fbeced8c81c3182e1dae31952d54b3;p=sliver-openvswitch.git diff --git a/lib/poll-loop.c b/lib/poll-loop.c index abd44d1be..510903e46 100644 --- a/lib/poll-loop.c +++ b/lib/poll-loop.c @@ -81,11 +81,13 @@ find_poll_node(struct poll_loop *loop, int fd, uint32_t wevent) * * On Windows system: * - * Register 'wevent' handle for the specified 'events'. These wevents are - * given to the handleMultipleObjects() to be polled. The event - * registration is one-shot: only the following call to poll_block() is - * affected. The event will need to be re-registered after poll_block() is - * called if it is to persist. + * If both 'wevent' handle and 'fd' is specified, associate the 'fd' with + * with that 'wevent' for 'events' (implemented in poll_block()). + * In case of no 'fd' specified, wake up on any event on that 'wevent'. + * These wevents are given to the WaitForMultipleObjects() to be polled. + * The event registration is one-shot: only the following call to + * poll_block() is affected. The event will need to be re-registered after + * poll_block() is called if it is to persist. * * ('where' is used in debug logging. Commonly one would use poll_fd_wait() to * automatically provide the caller's source file and line number for @@ -293,6 +295,16 @@ poll_block(void) pollfds[i] = node->pollfd; #ifdef _WIN32 wevents[i] = node->wevent; + if (node->pollfd.fd && node->wevent) { + short int wsa_events = 0; + if (node->pollfd.events & POLLIN) { + wsa_events |= FD_READ | FD_ACCEPT | FD_CLOSE; + } + if (node->pollfd.events & POLLOUT) { + wsa_events |= FD_WRITE | FD_CONNECT | FD_CLOSE; + } + WSAEventSelect(node->pollfd.fd, node->wevent, wsa_events); + } #endif i++; }