diff options
author | Paul Adenot <[email protected]> | 2020-10-28 18:17:19 +0100 |
---|---|---|
committer | Paul Adenot <[email protected]> | 2020-10-28 18:17:19 +0100 |
commit | c9cbabf67857f49e710874cd63b9f7f3f940c78b (patch) | |
tree | 13604ef4b8dbfa3e1a87ab1119f87e851d88df15 | |
parent | 05e27634df4a4d595ec1693de3e9f158a55c7101 (diff) | |
download | cubeb-c9cbabf67857f49e710874cd63b9f7f3f940c78b.tar.gz cubeb-c9cbabf67857f49e710874cd63b9f7f3f940c78b.zip |
Don't use exception in the new cubeb_aaudio.cpp, and don't build with exception or RTTI
-rw-r--r-- | CMakeLists.txt | 5 | ||||
-rw-r--r-- | src/cubeb_aaudio.cpp | 34 |
2 files changed, 16 insertions, 23 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index f8813c2..f19e2b5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -60,7 +60,10 @@ endif() set(CMAKE_CXX_WARNING_LEVEL 4) if(NOT MSVC) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wno-unused-parameter") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wno-unused-parameter") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wno-unused-parameter -fno-exceptions -fno-rtti") +else() + string(REPLACE "/GR" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) # Disable RTTI + string(REPLACE "/EHsc" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) # Disable Exceptions endif() add_library(cubeb diff --git a/src/cubeb_aaudio.cpp b/src/cubeb_aaudio.cpp index 9515201..92fc63d 100644 --- a/src/cubeb_aaudio.cpp +++ b/src/cubeb_aaudio.cpp @@ -451,15 +451,11 @@ aaudio_destroy(cubeb * ctx) ctx->state.join.store(true); ctx->state.cond.notify_all(); - try { - if(ctx->state.thread.joinable()) { - ctx->state.thread.join(); - } - if(ctx->state.notifier.joinable()) { - ctx->state.notifier.join(); - } - } catch(const std::system_error& err) { - LOG("Joining thread failed: %s", err.what()); + if(ctx->state.thread.joinable()) { + ctx->state.thread.join(); + } + if(ctx->state.notifier.joinable()) { + ctx->state.notifier.join(); } if (ctx->libaaudio) { @@ -1340,19 +1336,13 @@ aaudio_init(cubeb ** context, char const * context_name) { ctx->ops = &aaudio_ops; ctx->libaaudio = libaaudio; - try { - ctx->state.thread = std::thread(state_thread, ctx); - - // NOTE: using platform-specific APIs we could set the priority of the - // notifier thread lower than the priority of the state thread. - // This way, it's more likely that the state thread will be woken up - // by the condition variable signal when both are currently waiting - ctx->state.notifier = std::thread(notifier_thread, ctx); - } catch(const std::exception& err) { - LOG("Failed to create thread: %s", err.what()); - aaudio_destroy(ctx); - return CUBEB_ERROR; - } + ctx->state.thread = std::thread(state_thread, ctx); + + // NOTE: using platform-specific APIs we could set the priority of the + // notifier thread lower than the priority of the state thread. + // This way, it's more likely that the state thread will be woken up + // by the condition variable signal when both are currently waiting + ctx->state.notifier = std::thread(notifier_thread, ctx); *context = ctx; return CUBEB_OK; |