Skip to content

Commit

Permalink
Move _post_main invocation to run_main
Browse files Browse the repository at this point in the history
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 <[email protected]>
Message-Id: <[email protected]>
  • Loading branch information
wkozaczuk authored and nyh committed May 20, 2019
1 parent b4a0422 commit 5deec8f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
8 changes: 4 additions & 4 deletions core/app.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);
}

Expand Down
1 change: 0 additions & 1 deletion include/osv/app.hh
Original file line number Diff line number Diff line change
Expand Up @@ -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(*)(),
Expand Down

0 comments on commit 5deec8f

Please sign in to comment.