On Sun, Jul 28, 2019 at 4:44 PM Renato Maia <maia.ren...@gmail.com> wrote: > > I just noticed that using libuv 1.30.2 built in Ubuntu 16.04, if I call > 'uv_close' on a 'uv_signal_t' which callback is going to be executed in the > same loop iteration, the callback of this 'uv_close' is never executed, no > matter how many times I call `uv_run`, even though it is 'uv_is_closing'. > > The attached code illustrates the problem by writing 'uv_pipe_t' with the > read end closed to cause a SIGPIPE. In the write callback I close the > 'uv_pipe_t' and a `uv_signal_t' previously started with SIGPIPE. The > 'uv_pipe_t' closes, but the 'uv_signal_t' never does. > > I also noticed that if I close any other handler after 'uv_run' returns, then > the 'uv_close' callback of the 'uv_signal_t' is called the next time I call > 'uv_run'. > > Does any one knows what I might be doing wrong in this code, or a workaround > for this problem? > > -- > Renato Maia
I think you found a bug. Can you open a GitHub issue? What happens is that uv_close() postpones closing the uv_signal_t until the event loop has had time to process the events coming from the signal handler. For some reason that doesn't happen with your test case. The internal I/O watcher it's waiting for never fires. -- 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 view this discussion on the web visit https://groups.google.com/d/msgid/libuv/CAHQurc9nJCdzX6os9dNLYKjcRM4Fk2cyAw%3Dr5vh48cGzvM854A%40mail.gmail.com.