From 4676db126aa72f2c44d260b74d1f60468485e683 Mon Sep 17 00:00:00 2001 From: Vinnie Falco Date: Mon, 9 Sep 2013 13:34:18 -0700 Subject: [PATCH] Remove BEAST_CATCH_UNHANDLED_EXCEPTIONS --- Builds/VisualStudio2012/BeastConfig.h | 8 -------- .../beast_core/native/beast_win32_Files.cpp | 8 ++------ .../beast_core/native/beast_win32_Threads.cpp | 16 ++++----------- modules/beast_core/system/PlatformDefs.h | 16 --------------- modules/beast_core/threads/beast_Thread.cpp | 20 ++++++++----------- .../beast_core/threads/beast_ThreadPool.cpp | 6 +----- 6 files changed, 15 insertions(+), 59 deletions(-) diff --git a/Builds/VisualStudio2012/BeastConfig.h b/Builds/VisualStudio2012/BeastConfig.h index 275464fd8..7f07cf01c 100644 --- a/Builds/VisualStudio2012/BeastConfig.h +++ b/Builds/VisualStudio2012/BeastConfig.h @@ -54,14 +54,6 @@ //#define BEAST_LOG_ASSERTIONS 1 #endif -/** Config: BEAST_CATCH_UNHANDLED_EXCEPTIONS - This will wrap certain operating system calls with exception catching - code that converts the system exception into a regular error. -*/ -#ifndef BEAST_CATCH_UNHANDLED_EXCEPTIONS -//#define BEAST_CATCH_UNHANDLED_EXCEPTIONS 0 -#endif - /** Config: BEAST_CHECK_MEMORY_LEAKS Enables a memory-leak check for certain objects when the app terminates. See the LeakChecked class for more details about enabling leak checking for diff --git a/modules/beast_core/native/beast_win32_Files.cpp b/modules/beast_core/native/beast_win32_Files.cpp index 228fe566a..5acb1fae0 100644 --- a/modules/beast_core/native/beast_win32_Files.cpp +++ b/modules/beast_core/native/beast_win32_Files.cpp @@ -860,12 +860,8 @@ bool Process::openDocument (const String& fileName, const String& parameters) { HINSTANCE hInstance = 0; - BEAST_TRY - { - hInstance = ShellExecute (0, 0, fileName.toWideCharPointer(), - parameters.toWideCharPointer(), 0, SW_SHOWDEFAULT); - } - BEAST_CATCH_ALL + hInstance = ShellExecute (0, 0, fileName.toWideCharPointer(), + parameters.toWideCharPointer(), 0, SW_SHOWDEFAULT); return hInstance > (HINSTANCE) 32; } diff --git a/modules/beast_core/native/beast_win32_Threads.cpp b/modules/beast_core/native/beast_win32_Threads.cpp index 6e850d59a..b08940116 100644 --- a/modules/beast_core/native/beast_win32_Threads.cpp +++ b/modules/beast_core/native/beast_win32_Threads.cpp @@ -335,26 +335,18 @@ bool DynamicLibrary::open (const String& name) { close(); - BEAST_TRY - { - handle = LoadLibrary (name.toWideCharPointer()); - } - BEAST_CATCH_ALL + handle = LoadLibrary (name.toWideCharPointer()); return handle != nullptr; } void DynamicLibrary::close() { - BEAST_TRY + if (handle != nullptr) { - if (handle != nullptr) - { - FreeLibrary ((HMODULE) handle); - handle = nullptr; - } + FreeLibrary ((HMODULE) handle); + handle = nullptr; } - BEAST_CATCH_ALL } void* DynamicLibrary::getFunction (const String& functionName) noexcept diff --git a/modules/beast_core/system/PlatformDefs.h b/modules/beast_core/system/PlatformDefs.h index e0f728416..f9bd910a1 100644 --- a/modules/beast_core/system/PlatformDefs.h +++ b/modules/beast_core/system/PlatformDefs.h @@ -172,22 +172,6 @@ template <> struct BeastStaticAssert { static void dummy() {} }; //------------------------------------------------------------------------------ -#if BEAST_CATCH_UNHANDLED_EXCEPTIONS -# define BEAST_TRY try -# define BEAST_CATCH_ALL catch (...) {} -# define BEAST_CATCH_ALL_ASSERT catch (...) { bassertfalse; } -# define BEAST_CATCH_EXCEPTION BEAST_CATCH_ALL - -#else -# define BEAST_TRY -# define BEAST_CATCH_EXCEPTION -# define BEAST_CATCH_ALL -# define BEAST_CATCH_ALL_ASSERT - -#endif - -//------------------------------------------------------------------------------ - #if BEAST_DEBUG || DOXYGEN /** A platform-independent way of forcing an inline function. Use the syntax: @code diff --git a/modules/beast_core/threads/beast_Thread.cpp b/modules/beast_core/threads/beast_Thread.cpp index ec3204206..fbc5fa5c1 100644 --- a/modules/beast_core/threads/beast_Thread.cpp +++ b/modules/beast_core/threads/beast_Thread.cpp @@ -79,22 +79,18 @@ void Thread::threadEntryPoint() const CurrentThreadHolder::Ptr currentThreadHolder (getCurrentThreadHolder()); currentThreadHolder->value = this; - BEAST_TRY + if (threadName.isNotEmpty()) + setCurrentThreadName (threadName); + + if (startSuspensionEvent.wait (10000)) { - if (threadName.isNotEmpty()) - setCurrentThreadName (threadName); + bassert (getCurrentThreadId() == threadId); - if (startSuspensionEvent.wait (10000)) - { - bassert (getCurrentThreadId() == threadId); + if (affinityMask != 0) + setCurrentThreadAffinityMask (affinityMask); - if (affinityMask != 0) - setCurrentThreadAffinityMask (affinityMask); - - run(); - } + run(); } - BEAST_CATCH_ALL_ASSERT currentThreadHolder->value.releaseCurrentThreadStorage(); closeThreadHandle(); diff --git a/modules/beast_core/threads/beast_ThreadPool.cpp b/modules/beast_core/threads/beast_ThreadPool.cpp index 951383066..71354bad0 100644 --- a/modules/beast_core/threads/beast_ThreadPool.cpp +++ b/modules/beast_core/threads/beast_ThreadPool.cpp @@ -332,11 +332,7 @@ bool ThreadPool::runNextJob() ThreadPoolJob::JobStatus result = ThreadPoolJob::jobHasFinished; - BEAST_TRY - { - result = job->runJob(); - } - BEAST_CATCH_ALL_ASSERT + result = job->runJob(); OwnedArray deletionList;