46 static constexpr size_t osDefaultStackSize { 0 };
86 jassert (isPositiveAndNotGreaterThan (
newPriority, 10));
87 return withMember (*
this, &RealtimeOptions::priority, juce::jlimit (0, 10,
newPriority));
127 jassert (sampleRate > 0.0);
144 return withMember (*
this, &RealtimeOptions::periodMs,
newPeriodMs);
177 return processingTimeMs;
187 return maximumProcessingTimeMs;
202 std::optional<double> processingTimeMs;
203 std::optional<double> maximumProcessingTimeMs;
204 std::optional<double> periodMs{};
220 explicit Thread (
const String& threadName,
size_t threadStackSize = osDefaultStackSize);
352 bool isThreadRunning()
const;
365 void signalThreadShouldExit();
374 bool threadShouldExit()
const;
382 static bool currentThreadShouldExit();
417 bool isRealtime()
const;
427 void setAffinityMask (uint32 affinityMask);
445 static void JUCE_CALLTYPE
sleep (
int milliseconds);
493 static Thread* JUCE_CALLTYPE getCurrentThread();
514 #if JUCE_ANDROID || DOXYGEN
584 std::atomic<void*> threadHandle {
nullptr };
585 std::atomic<ThreadID> threadId {
nullptr };
586 std::optional<RealtimeOptions> realtimeOptions = {};
587 CriticalSection startStopLock;
588 WaitableEvent startSuspensionEvent, defaultEvent;
589 size_t threadStackSize;
590 uint32 affinityMask = 0;
591 bool deleteOnThreadEnd =
false;
592 std::atomic<bool> shouldExit {
false };
593 ListenerList<Listener, Array<Listener*, CriticalSection>> listeners;
595 #if JUCE_ANDROID || JUCE_LINUX || JUCE_BSD
596 std::atomic<Priority> priority;
600 friend void JUCE_API juce_threadEntryPoint (
void*);
603 bool startThreadInternal (Priority);
604 bool createNativeThread (Priority);
605 void closeThreadHandle();
607 void threadEntryPoint();
609 JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (Thread)