Skip to content

Commit 5deec8f

Browse files
wkozaczuknyh
authored andcommitted
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 <[email protected]> Message-Id: <[email protected]>
1 parent b4a0422 commit 5deec8f

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

core/app.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -318,10 +318,6 @@ void application::main()
318318

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

420+
if(_post_main) {
421+
_post_main();
422+
}
423+
424424
trace_app_main_ret(_return_code);
425425
}
426426

include/osv/app.hh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,6 @@ private:
216216
void start();
217217
void start_and_join(waiter* setup_waiter);
218218
void main();
219-
void run_main(std::string path, int argc, char** argv);
220219
void prepare_argv(elf::program *program);
221220
void run_main();
222221
friend void ::__libc_start_main(int(*)(int, char**), int, char**, void(*)(),

0 commit comments

Comments
 (0)