From a7cb7f23a4c6dbeed4bf29098fd80afbe3231350 Mon Sep 17 00:00:00 2001 From: Vinnie Falco Date: Wed, 14 Aug 2013 09:40:01 -0700 Subject: [PATCH] Consolidate Process::terminate code --- .../modules/beast_core/native/beast_android_Threads.cpp | 6 ------ .../modules/beast_core/native/beast_bsd_Threads.cpp | 6 ------ .../modules/beast_core/native/beast_linux_Threads.cpp | 6 ------ .../beast/modules/beast_core/native/beast_mac_Threads.mm | 6 ------ .../modules/beast_core/native/beast_posix_SharedCode.h | 9 +++++++++ 5 files changed, 9 insertions(+), 24 deletions(-) diff --git a/Subtrees/beast/modules/beast_core/native/beast_android_Threads.cpp b/Subtrees/beast/modules/beast_core/native/beast_android_Threads.cpp index 821d65f4ba..fe0e7aaf9b 100644 --- a/Subtrees/beast/modules/beast_core/native/beast_android_Threads.cpp +++ b/Subtrees/beast/modules/beast_core/native/beast_android_Threads.cpp @@ -57,12 +57,6 @@ void Process::setPriority (ProcessPriority prior) pthread_setschedparam (pthread_self(), policy, ¶m); } -void Process::terminate() -{ - // TODO - exit (0); -} - BEAST_API bool BEAST_CALLTYPE beast_isRunningUnderDebugger() { return false; diff --git a/Subtrees/beast/modules/beast_core/native/beast_bsd_Threads.cpp b/Subtrees/beast/modules/beast_core/native/beast_bsd_Threads.cpp index 9919a52500..c6160ca056 100644 --- a/Subtrees/beast/modules/beast_core/native/beast_bsd_Threads.cpp +++ b/Subtrees/beast/modules/beast_core/native/beast_bsd_Threads.cpp @@ -47,12 +47,6 @@ void Process::setPriority (const ProcessPriority prior) pthread_setschedparam (pthread_self(), policy, ¶m); } -void Process::terminate() -{ - // http://www.unix.com/man-page/FreeBSD/2/_exit/ - ::_exit (EXIT_FAILURE); -} - BEAST_API bool BEAST_CALLTYPE beast_isRunningUnderDebugger() { // XXX not implemented for FreeBSD! diff --git a/Subtrees/beast/modules/beast_core/native/beast_linux_Threads.cpp b/Subtrees/beast/modules/beast_core/native/beast_linux_Threads.cpp index edb67d28ba..9dafe89df4 100644 --- a/Subtrees/beast/modules/beast_core/native/beast_linux_Threads.cpp +++ b/Subtrees/beast/modules/beast_core/native/beast_linux_Threads.cpp @@ -47,12 +47,6 @@ void Process::setPriority (const ProcessPriority prior) pthread_setschedparam (pthread_self(), policy, ¶m); } -void Process::terminate() -{ - // http://linux.die.net/man/2/_exit - ::_exit (EXIT_FAILURE); -} - BEAST_API bool BEAST_CALLTYPE beast_isRunningUnderDebugger() { static char testResult = 0; diff --git a/Subtrees/beast/modules/beast_core/native/beast_mac_Threads.mm b/Subtrees/beast/modules/beast_core/native/beast_mac_Threads.mm index 572aca2729..fad59a4e22 100644 --- a/Subtrees/beast/modules/beast_core/native/beast_mac_Threads.mm +++ b/Subtrees/beast/modules/beast_core/native/beast_mac_Threads.mm @@ -53,12 +53,6 @@ void Process::lowerPrivilege() bassertfalse; } -void Process::terminate() -{ - // https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man2/_exit.2.html - ::_exit(EXIT_FAILURE); -} - void Process::setPriority (ProcessPriority) { // xxx diff --git a/Subtrees/beast/modules/beast_core/native/beast_posix_SharedCode.h b/Subtrees/beast/modules/beast_core/native/beast_posix_SharedCode.h index b610dafebb..cb686d260a 100644 --- a/Subtrees/beast/modules/beast_core/native/beast_posix_SharedCode.h +++ b/Subtrees/beast/modules/beast_core/native/beast_posix_SharedCode.h @@ -148,6 +148,15 @@ void BEAST_CALLTYPE Thread::sleep (int millisecs) nanosleep (&time, nullptr); } +void Process::terminate() +{ +#if BEAST_ANDROID || BEAST_BSD + // http://www.unix.com/man-page/FreeBSD/2/_exit/ + ::_exit (EXIT_FAILURE); +#else + std::_Exit (EXIT_FAILURE); +#endif +} //============================================================================== const beast_wchar File::separator = '/';