libuv: add helper for clean valgrind with foreign loop
This commit is contained in:
parent
ffa5898afe
commit
a15007269e
3 changed files with 11 additions and 1 deletions
|
@ -262,6 +262,12 @@ static void lws_uv_walk_cb(uv_handle_t *handle, void *arg)
|
||||||
uv_close(handle, lws_uv_close_cb);
|
uv_close(handle, lws_uv_close_cb);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LWS_VISIBLE void
|
||||||
|
lws_close_all_handles_in_loop(uv_loop_t *loop)
|
||||||
|
{
|
||||||
|
uv_walk(loop, lws_uv_walk_cb, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
lws_libuv_destroyloop(struct lws_context *context, int tsi)
|
lws_libuv_destroyloop(struct lws_context *context, int tsi)
|
||||||
{
|
{
|
||||||
|
|
|
@ -3540,6 +3540,9 @@ lws_uv_getloop(struct lws_context *context, int tsi);
|
||||||
|
|
||||||
LWS_VISIBLE LWS_EXTERN void
|
LWS_VISIBLE LWS_EXTERN void
|
||||||
lws_uv_sigint_cb(uv_signal_t *watcher, int signum);
|
lws_uv_sigint_cb(uv_signal_t *watcher, int signum);
|
||||||
|
|
||||||
|
LWS_VISIBLE LWS_EXTERN void
|
||||||
|
lws_close_all_handles_in_loop(uv_loop_t *loop);
|
||||||
#endif /* LWS_USE_LIBUV */
|
#endif /* LWS_USE_LIBUV */
|
||||||
///@}
|
///@}
|
||||||
|
|
||||||
|
|
|
@ -303,8 +303,9 @@ int main(int argc, char **argv)
|
||||||
lws_context_destroy(context);
|
lws_context_destroy(context);
|
||||||
|
|
||||||
#if (UV_VERSION_MAJOR > 0) // Travis...
|
#if (UV_VERSION_MAJOR > 0) // Travis...
|
||||||
|
lws_close_all_handles_in_loop(&loop);
|
||||||
n = 0;
|
n = 0;
|
||||||
while (n++ < 1024 && uv_loop_close(&loop))
|
while (n++ < 4096 && uv_loop_close(&loop))
|
||||||
uv_run(&loop, UV_RUN_NOWAIT);
|
uv_run(&loop, UV_RUN_NOWAIT);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue