From: Waldemar Kozaczuk <jwkozac...@gmail.com>
Committer: Nadav Har'El <n...@scylladb.com>
Branch: master

Move _post_main invocation to run_main

This patch also fixes __libc_start_main() used for example
by java to terminate any remaining app threads by _post_main.

Signed-off-by: Waldemar Kozaczuk <jwkozac...@gmail.com>
Message-Id: <20190519204708.16548-1-jwkozac...@gmail.com>

---
diff --git a/core/app.cc b/core/app.cc
--- a/core/app.cc
+++ b/core/app.cc
@@ -318,10 +318,6 @@ void application::main()

     if (_main) {
         run_main();
-
-        if(_post_main) {
-            _post_main();
-        }
     } else {
         // The application is expected not to initialize the environment in
// which it runs on its owns but to call __libc_start_main(). If that's
@@ -421,6 +417,10 @@ void application::run_main()
         debug("program %s returned %d\n", _command.c_str(), _return_code);
     }

+    if(_post_main) {
+        _post_main();
+    }
+
     trace_app_main_ret(_return_code);
 }

diff --git a/include/osv/app.hh b/include/osv/app.hh
--- a/include/osv/app.hh
+++ b/include/osv/app.hh
@@ -216,7 +216,6 @@ private:
     void start();
     void start_and_join(waiter* setup_waiter);
     void main();
-    void run_main(std::string path, int argc, char** argv);
     void prepare_argv(elf::program *program);
     void run_main();
friend void ::__libc_start_main(int(*)(int, char**), int, char**, void(*)(),

--
You received this message because you are subscribed to the Google Groups "OSv 
Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to osv-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/osv-dev/000000000000d5be9905894dda78%40google.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to