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> --- core/app.cc | 8 ++++---- include/osv/app.hh | 1 - 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/core/app.cc b/core/app.cc index fbd033aa..e124353d 100644 --- 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 index 1f4d2d6d..d98ef4e5 100644 --- 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(*)(), -- 2.20.1 -- 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/20190519204708.16548-1-jwkozaczuk%40gmail.com. For more options, visit https://groups.google.com/d/optout.