62 explicit Thread (
const String& threadName,
size_t threadStackSize = 0);
82 virtual void run() = 0;
101 void startThread (
int priority);
123 bool stopThread (
int timeOutMilliseconds);
137 static void launch (std::function<
void()> functionToRun);
141 bool isThreadRunning()
const;
154 void signalThreadShouldExit();
163 bool threadShouldExit()
const;
171 static bool currentThreadShouldExit();
180 bool waitForThreadToExit (
int timeOutMilliseconds)
const;
192 virtual void exitSignalSent() = 0;
228 realtimeAudioPriority = -1
239 bool setPriority (
int priority);
248 static bool setCurrentThreadPriority (
int priority);
258 void setAffinityMask (uint32 affinityMask);
266 static void JUCE_CALLTYPE setCurrentThreadAffinityMask (uint32 affinityMask);
276 static void JUCE_CALLTYPE sleep (
int milliseconds);
283 static void JUCE_CALLTYPE yield();
293 bool wait (
int timeOutMilliseconds)
const;
317 static ThreadID JUCE_CALLTYPE getCurrentThreadId();
324 static Thread* JUCE_CALLTYPE getCurrentThread();
334 ThreadID getThreadId() const noexcept;
337 const
String& getThreadName() const noexcept {
return threadName; }
343 static void JUCE_CALLTYPE setCurrentThreadName (
const String& newThreadName);
345 #if JUCE_ANDROID || defined (DOXYGEN) 384 static void initialiseJUCE (
void* jniEnv,
void* jContext);
394 int threadPriority = 5;
395 size_t threadStackSize;
396 uint32 affinityMask = 0;
397 bool deleteOnThreadEnd =
false;
402 bool isAndroidRealtimeThread =
false;
406 friend void JUCE_API juce_threadEntryPoint (
void*);
410 void closeThreadHandle();
412 void threadEntryPoint();
413 static bool setThreadPriority (
void*,
int);
415 JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (
Thread)
A simple wrapper around std::atomic.
#define JUCE_API
This macro is added to all JUCE public class declarations.
void * ThreadID
A value type used for thread IDs.
Allows threads to wait for events triggered by other threads.
Holds a set of objects and can invoke a member function callback on each object in the set with a sin...
Used to receive callbacks for thread exit calls.