Heya!
Excerpt from a documentation about `uv_stop()`:
/*
* This function will stop the event loop by forcing uv_run to end
* as soon as possible, but not sooner than the next loop iteration.
* If this function was called before blocking for i/o, the loop won't
* block for i/o on this iteration.
*/
So the `uv_stop()` is forcing `uv_run()` to return, even if there are still
some active handles on the loop. You should close all of them before attempting
to call `uv_loop_close()`, and you could do while walking through all active
handles in loop:
/*
* Walk the list of open handles.
*/
UV_EXTERN void uv_walk(uv_loop_t* loop, uv_walk_cb walk_cb, void* arg);
Cheers,
Fedor.
On Tue, Mar 18, 2014 at 6:05 AM, David Davidović <[email protected]> wrote:
> Sorry if this a stupid question and shows my failure of grasping the basic
> concepts but I feel completely lost. So I have a watchdog timer whose job is
> to check every 30 seconds if there is a global kill switch flag set for the
> daemon, and if there is, it calls uv_stop() on the loop. (I understand I
> could just exit() from there but I like to keep valgrind happy at the end of
> program execution while debugging.) uv_run() returns after that, but when I
> try calling uv_loop_close() it returns UV_BUSY, and subsequent calls to
> uv_loop_delete() try the same and bomb with a SIGABRT because of an
> assertion failure. I'm not sure as to how this could happen, shouldn't
> uv_run() returning imply that the loop is done processing all of its data?
> Maybe if libuv runs its own threadpool somewhere, is there any way I can
> join on these threads as they could be the cause of the problem? How should
> I safely and successfully terminate the loop in such a condition?
>
> TIA!
>
> --
> 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 [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/libuv.
> For more options, visit https://groups.google.com/d/optout.
--
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/libuv.
For more options, visit https://groups.google.com/d/optout.