Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7965515
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T06:10:50+00:00 2026-06-04T06:10:50+00:00

I have an application which uses libuv library. it runs default loop: uv_run(uv_default_loop()); How

  • 0

I have an application which uses libuv library. it runs default loop:

uv_run(uv_default_loop());

How can the application be gracefully exited in case of a failure? Currently I am doing it like in the following example:

uv_tcp_t* tcp = malloc(sizeof(uv_tcp_t));
int r = uv_tcp_init(uv_default_loop(), tcp);

if (r) {
  free(tcp);
  uv_loop_delete(default_loop);
  exit(EXIT_FAILURE);
}

Should uv_loop_delete function be called? What does it do? Does it drop all pending callback functions? Does it close all currently opened TCP connections? Do I have to do it manually before exiting?

P.S.: Can’t add the tag ‘libuv’ (less than 1500 reputation). Can somebody create and add it?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T06:10:52+00:00Added an answer on June 4, 2026 at 6:10 am

    Declaration of uv_loop_delete is here and source code is here. It looks like this:

    void uv_loop_delete(uv_loop_t* loop) {
      uv_ares_destroy(loop, loop->channel);
      ev_loop_destroy(loop->ev);
    #if __linux__
      if (loop->inotify_fd == -1) return;
      ev_io_stop(loop->ev, &loop->inotify_read_watcher);
      close(loop->inotify_fd);
      loop->inotify_fd = -1;
    #endif
    #if HAVE_PORTS_FS
      if (loop->fs_fd != -1)
        close(loop->fs_fd);
    #endif
    }
    

    It will, effectively, clean every file descriptor it’s possible to clean. It will close TCP connection, Inotify connections, Socket used to read events, Pipe fds, etc, etc.

    => Yes, this function will close everything you have opened through libuv.

    NB: Anyway, when your application exit, your Operating System will clean and close everything you have left open, without any mercy.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have C# application which uses weifenluo.winformsui.docking.dll 2.3.1.0 for Docking. It runs nicely in
I have an application which uses some external library for analytics. Problem is that
I have an application which uses JSPs and Servlets and deployed on IBM-WASCE 2.1.
I have a little application which uses regular expressions under VB6. It works perfectly
I have a window application which uses SP classes to create a site. I
I have made an application which uses latest ios facebook sdk to connect. I
I have an IOS application which uses environment variables and am able to set
I have a Windows Service application which uses a Threading.Timer and a TimerCallback to
I have a simple iPhone application which uses OpenGL ES (v1) to draw a
I have a core data application which uses a navigation controller to drill down

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.