help icon indicating copy to clipboard operation
help copied to clipboard

Is there away to call uv_close without close associated file descriptor

Open phpstatic opened this issue 4 years ago • 3 comments
trafficstars

I need destroy the uv_poll_t object, but keep the fd alive. is there a way to do this?

phpstatic avatar Feb 14 '21 15:02 phpstatic

Yes. In fact, that's the standard mode of operation - you, the libuv user, are responsible for closing the corresponding file descriptor.

bnoordhuis avatar Feb 14 '21 18:02 bnoordhuis

accord the documents: http://docs.libuv.org/en/v1.x/handle.html uv_close

Handles that wrap file descriptors are closed immediately but close_cb will still be deferred to the next iteration of the event loop. It gives you a chance to free up any resources associated with the handle.

If that's the standard mode of operation, maybe this document should be modifed.

phpstatic avatar Feb 15 '21 02:02 phpstatic

I mean it's the standard mode of operation for uv_poll_t. Its documentation mentions how it's different from libuv's general mode of operation.

bnoordhuis avatar Feb 15 '21 08:02 bnoordhuis