From 90f3d11ab8a401ec137d804366a453e4698b07c2 Mon Sep 17 00:00:00 2001 From: Tom Poole Date: Tue, 2 Jan 2018 17:52:36 +0000 Subject: [PATCH] Fixed an issue terminating threads on iOS --- modules/juce_core/threads/juce_Thread.cpp | 10 ++++++++++ modules/juce_core/threads/juce_Thread.h | 4 ++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/modules/juce_core/threads/juce_Thread.cpp b/modules/juce_core/threads/juce_Thread.cpp index 1db59dce89..a9ea95c843 100644 --- a/modules/juce_core/threads/juce_Thread.cpp +++ b/modules/juce_core/threads/juce_Thread.cpp @@ -167,6 +167,11 @@ Thread* JUCE_CALLTYPE Thread::getCurrentThread() return getCurrentThreadHolder()->value.get(); } +Thread::ThreadID Thread::getThreadId() const noexcept +{ + return threadId.get(); +} + //============================================================================== void Thread::signalThreadShouldExit() { @@ -174,6 +179,11 @@ void Thread::signalThreadShouldExit() listeners.call ([] (Listener& l) { l.exitSignalSent(); }); } +bool Thread::threadShouldExit() const +{ + return shouldExit.get() != 0; +} + bool Thread::currentThreadShouldExit() { if (auto* currentThread = getCurrentThread()) diff --git a/modules/juce_core/threads/juce_Thread.h b/modules/juce_core/threads/juce_Thread.h index a1bbede37f..f759a3ee18 100644 --- a/modules/juce_core/threads/juce_Thread.h +++ b/modules/juce_core/threads/juce_Thread.h @@ -153,7 +153,7 @@ public: @see signalThreadShouldExit, currentThreadShouldExit */ - bool threadShouldExit() const { return shouldExit.get() != 0; } + bool threadShouldExit() const; /** Checks whether the current thread has been told to stop running. On the message thread, this will always return false, otherwise @@ -309,7 +309,7 @@ public: thread's not actually running. @see getCurrentThreadId */ - ThreadID getThreadId() const noexcept { return threadId.get(); } + ThreadID getThreadId() const noexcept; /** Returns the name of the thread. This is the name that gets set in the constructor.