From 6e6e16e2ba97cd4f3d8df6ad7a6808452d1fcfa3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Branimir=20Karad=C5=BEi=C4=87?= Date: Tue, 9 Jun 2015 22:24:49 -0700 Subject: [PATCH] Pass thread exit code from app thread as process exit code. Issue #430. --- examples/common/entry/entry_sdl.cpp | 7 ++++--- examples/common/entry/entry_windows.cpp | 2 +- examples/common/entry/entry_x11.cpp | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/examples/common/entry/entry_sdl.cpp b/examples/common/entry/entry_sdl.cpp index 91bfef74..d8ba1b47 100644 --- a/examples/common/entry/entry_sdl.cpp +++ b/examples/common/entry/entry_sdl.cpp @@ -320,7 +320,7 @@ namespace entry initTranslateGamepadAxis(SDL_CONTROLLER_AXIS_TRIGGERRIGHT, GamepadAxis::RightZ); } - void run(int _argc, char** _argv) + int run(int _argc, char** _argv) { m_mte.m_argc = _argc; m_mte.m_argv = _argv; @@ -710,6 +710,8 @@ namespace entry SDL_DestroyWindow(m_window[0]); SDL_Quit(); + + return m_thread.getExitCode(); } WindowHandle findHandle(uint32_t _windowId) @@ -896,8 +898,7 @@ namespace entry int main(int _argc, char** _argv) { using namespace entry; - s_ctx.run(_argc, _argv); - return 0; + return s_ctx.run(_argc, _argv); } #endif // ENTRY_CONFIG_USE_SDL diff --git a/examples/common/entry/entry_windows.cpp b/examples/common/entry/entry_windows.cpp index 26f496d6..376ce8ac 100644 --- a/examples/common/entry/entry_windows.cpp +++ b/examples/common/entry/entry_windows.cpp @@ -499,7 +499,7 @@ namespace entry s_xinput.shutdown(); - return 0; + return thread.getExitCode(); } LRESULT process(HWND _hwnd, UINT _id, WPARAM _wparam, LPARAM _lparam) diff --git a/examples/common/entry/entry_x11.cpp b/examples/common/entry/entry_x11.cpp index 44a501e7..ff1768c7 100644 --- a/examples/common/entry/entry_x11.cpp +++ b/examples/common/entry/entry_x11.cpp @@ -477,7 +477,7 @@ namespace entry XUnmapWindow(m_display, m_window[0]); XDestroyWindow(m_display, m_window[0]); - return EXIT_SUCCESS; + return thread.getExitCode(); } void setModifier(Modifier::Enum _modifier, bool _set)