58 explicit Thread (
const String& threadName,
size_t threadStackSize = 0);
78 virtual void run() = 0;
97 void startThread (
int priority);
119 bool stopThread (
int timeOutMilliseconds);
133 static void launch (std::function<
void()> functionToRun);
137 bool isThreadRunning()
const;
150 void signalThreadShouldExit();
159 bool threadShouldExit()
const;
167 static bool currentThreadShouldExit();
176 bool waitForThreadToExit (
int timeOutMilliseconds)
const;
224 realtimeAudioPriority = -1
235 bool setPriority (
int priority);
244 static bool setCurrentThreadPriority (
int priority);
254 void setAffinityMask (uint32 affinityMask);
272 static void JUCE_CALLTYPE
sleep (
int milliseconds);
289 bool wait (
int timeOutMilliseconds)
const;
320 static Thread* JUCE_CALLTYPE getCurrentThread();
330 ThreadID getThreadId() const noexcept;
333 const
String& getThreadName() const noexcept {
return threadName; }
341 #if JUCE_ANDROID || defined (DOXYGEN)
380 static void initialiseJUCE (
void* jniEnv,
void* jContext);
388 CriticalSection startStopLock;
389 WaitableEvent startSuspensionEvent, defaultEvent;
390 int threadPriority = 5;
391 size_t threadStackSize;
392 uint32 affinityMask = 0;
393 bool deleteOnThreadEnd =
false;
394 Atomic<int32> shouldExit { 0 };
395 ListenerList<Listener, Array<Listener*, CriticalSection>> listeners;
398 bool isAndroidRealtimeThread =
false;
402 friend void JUCE_API juce_threadEntryPoint (
void*);
406 void closeThreadHandle();
408 void threadEntryPoint();
409 static bool setThreadPriority (
void*,
int);
411 JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (Thread)