First I ask for a clarification of the behavior of uv_close. Doc says "Handles that wrap file descriptors are closed immediately but..." However it does not clearly say that the wrapped file descriptor is closed. It is perhaps obvious that this is the reasonable behavior, but I ask anyway, for a reason.
I write code that combines libuv with another event handler, we can call it "eventlib". I do this for legacy reasons. I let eventlib create a socket connection, then I let uv wrap a TCP handle around it using uv_tcp_open(handle, fd). It should be noted that the socket file descriptor was not opened by uv. Later at cleanup time I want to detach the uv TCP handle from this fd and close the handle; ideally I would like to restore the state to before uv_tcp_open was called, meaning close the handle without closing the fd; since uv did not open the fd. Then I can call the eventlib methods to close its handles and implicitly close the fd; since eventlib did open the fd. However, the only tool I can find to do this is uv_close(handle) and I guess it will close handle as well as its associated fd. So both eventlib and libuv want to close the same fd, perhaps harmless but not nice. Should I instead duplicate the fd opened by eventlib and give the duplicate to libuv? Then eventlib and uv will each have its own fd describing the same socket, and it avoids the risk of closing the same fd twice. This solution however assumes that uv_close will indeed close the fd. So again, the clarification please. BR /Anders -- You received this message because you are subscribed to the Google Groups "libuv" group. To unsubscribe from this group and stop receiving emails from it, send an email to libuv+unsubscr...@googlegroups.com. To post to this group, send email to libuv@googlegroups.com. Visit this group at https://groups.google.com/group/libuv. For more options, visit https://groups.google.com/d/optout.