help icon indicating copy to clipboard operation
help copied to clipboard

Can't STOP the uv_run!!!

Open jinfeihan57 opened this issue 4 years ago • 2 comments

  • Version: 1.41
  • Platform: Red Hat 7.6 I use one thread to run uv_run() and another thread to call uv_stop(). Why uv_run() cannot exit? After debugging, I found that uv_run() is blocked at line 324 of libuv/src/unix/linux-core.c, epoll_wait() function. And the timeout value is -1.

jinfeihan57 avatar Apr 17 '21 07:04 jinfeihan57

More detals. I use uv_poll_init_socket() uv_poll_start() and uv_poll_stop() to manage tcp connection descriptors. When the connection is disconnected, call uv_poll_stop() to stop poll, and call uv_close() to close uv_tcp_t. Then call uv_stop(). But uv_run() does not stop.

jinfeihan57 avatar Apr 17 '21 07:04 jinfeihan57

Moved to libuv/help. If you want to wake up the event loop from another thread, use uv_async_send(), then call uv_stop() from the async handle's callback.

bnoordhuis avatar Apr 17 '21 09:04 bnoordhuis