DPF

DISTRHO Plugin Framework
Log | Files | Refs | Submodules | README | LICENSE

commit 1ccefd8c7298f0b459ef9c8d6dc42b49a4afc5eb
parent 550fab3866436c9daa0992bf94bdd7e411289232
Author: falkTX <falktx@falktx.com>
Date:   Sat,  3 Jul 2021 22:57:37 +0100

Mention thread-safety on Application class

Signed-off-by: falkTX <falktx@falktx.com>

Diffstat:
Mdgl/Application.hpp | 4++++
Mdgl/src/ApplicationPrivateData.cpp | 4++--
2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/dgl/Application.hpp b/dgl/Application.hpp @@ -30,6 +30,8 @@ START_NAMESPACE_DGL There's no single/global application instance in DGL, and multiple windows can share the same app instance. In standalone mode an application will automatically quit its event-loop when all its windows are closed. + + Unless stated otherwise, functions within this class are not thread-safe. */ class Application { @@ -61,6 +63,7 @@ public: /** Quit the application. This stops the event-loop and closes all Windows. + This function is thread-safe. @note This function is meant for standalones only, *never* call this from plugins. */ void quit(); @@ -68,6 +71,7 @@ public: /** Check if the application is about to quit. Returning true means there's no event-loop running at the moment (or it's just about to stop). + This function is thread-safe. */ bool isQuiting() const noexcept; diff --git a/dgl/src/ApplicationPrivateData.cpp b/dgl/src/ApplicationPrivateData.cpp @@ -34,7 +34,7 @@ static ThreadHandle getCurrentThreadHandle() noexcept #endif } -static bool isThisMainThread(const ThreadHandle mainThreadHandle) noexcept +static bool isThisTheMainThread(const ThreadHandle mainThreadHandle) noexcept { #ifdef DISTRHO_OS_WINDOWS return GetCurrentThread() == mainThreadHandle; // IsGUIThread ? @@ -127,7 +127,7 @@ void Application::PrivateData::quit() { DISTRHO_SAFE_ASSERT_RETURN(isStandalone,); - if (! isThisMainThread(mainThreadHandle)) + if (! isThisTheMainThread(mainThreadHandle)) { if (! isQuittingInNextCycle) {