Tarantool development patches archive
 help / color / mirror / Atom feed
From: Serge Petrenko <sergepetrenko@tarantool.org>
To: vdavydov.dev@gmail.com, kostja@tarantool.org
Cc: tarantool-patches@freelists.org,
	Serge Petrenko <sergepetrenko@tarantool.org>
Subject: [PATCH v5 3/3] box: get rid of atexit() for calling cleanup routines
Date: Fri, 25 Jan 2019 18:41:34 +0300	[thread overview]
Message-ID: <12ddd86a29af0d38f773af9d2304a4e583c9c196.1548430046.git.sergepetrenko@tarantool.org> (raw)
In-Reply-To: <cover.1548430046.git.sergepetrenko@tarantool.org>
In-Reply-To: <cover.1548430046.git.sergepetrenko@tarantool.org>

Move a call to tarantool_free() to the end of main().
We needn't call atexit() at all anymore, since we've implemented
on_shutdown triggers and patched os.exit() so that when exiting not
due to a fatal signal (when no cleanup routines are called anyway)
control always reaches a call to tarantool_free().
---
 src/main.cc | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/src/main.cc b/src/main.cc
index a3d1a6f22..3fc2dd310 100644
--- a/src/main.cc
+++ b/src/main.cc
@@ -800,9 +800,6 @@ main(int argc, char **argv)
 		trigger_create(&shutdown_trig, break_loop, NULL, NULL);
 		trigger_add(&box_on_shutdown, &shutdown_trig);
 
-		/* main core cleanup routine */
-		atexit(tarantool_free);
-
 		if (!loop())
 			panic("%s", "can't init event loop");
 
@@ -841,5 +838,6 @@ main(int argc, char **argv)
 	if (start_loop)
 		say_crit("exiting the event loop");
 	/* freeing resources */
+	tarantool_free();
 	return exit_code;
 }
-- 
2.17.2 (Apple Git-113)

  parent reply	other threads:[~2019-01-25 15:41 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-25 15:41 [PATCH v5 0/3] box: implement on_shutdown triggers Serge Petrenko
2019-01-25 15:41 ` [PATCH v5 1/3] " Serge Petrenko
2019-01-28  8:43   ` Vladimir Davydov
2019-01-29 14:47     ` Serge Petrenko
2019-01-25 15:41 ` [PATCH v5 2/3] lua: patch os.exit() to execute " Serge Petrenko
2019-01-28  8:45   ` Vladimir Davydov
2019-01-29 14:49     ` [tarantool-patches] " Serge Petrenko
2019-01-25 15:41 ` Serge Petrenko [this message]
2019-01-30 10:52 ` [PATCH v5 0/3] box: implement " Vladimir Davydov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=12ddd86a29af0d38f773af9d2304a4e583c9c196.1548430046.git.sergepetrenko@tarantool.org \
    --to=sergepetrenko@tarantool.org \
    --cc=kostja@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --cc=vdavydov.dev@gmail.com \
    --subject='Re: [PATCH v5 3/3] box: get rid of atexit() for calling cleanup routines' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox