luvit / luv

Bare libuv bindings for lua
Apache License 2.0
831 stars 187 forks source link

feat: support events is zero for uv_poll #702

Open uudiin opened 6 months ago

uudiin commented 6 months ago

As the poll() manual says that events field may be specified as zero, in which case the only events that can be returned in revents are POLLHUP, POLLERR, and POLLNVAL. This patch allows luv to support this call method with events equal zero. When the parameters in the lua is an empty string, it means that events is zero.

zhaozg commented 2 weeks ago

LGTM, please @squeek502 give suggestion

squeek502 commented 2 weeks ago

I'm not sure the changes in this PR would have the intended effect judging by the Libuv implementation of uv_poll_start. In both win and unix implementations, events == 0 is an early return:

https://github.com/libuv/libuv/blob/d4ab6fbba4669935a6bc23645372dfe4ac29ab39/src/win/poll.c#L498-L501

https://github.com/libuv/libuv/blob/d4ab6fbba4669935a6bc23645372dfe4ac29ab39/src/unix/poll.c#L137-L138


Other minor things:

zhaozg commented 1 week ago

Please rebase, wait CI pass to merge the PR.

zhaozg commented 6 days ago

I don't think this should be merged until it's proven that passing 0 for events has the intended effect.

sure