15#include "dawn/porting/config.hxx"
99 template<
typename Func>
102 threadFunc = std::forward<Func>(func);
111 threadConfig = config;
207 bool shouldQuit()
const
209 return thQuit.load();
212 bool isStopped()
const
214 return thQuitDone.load();
217 bool hasThreadObject()
const
227 void clearStopRequest()
232 void markThreadFinished()
245 template<
typename Func>
299 std::atomic_bool thQuit;
300 std::atomic_bool thQuitDone;
301 std::function<void()> threadFunc;
302 SThreadConfig threadConfig;
305 int buildThreadAttr(pthread_attr_t &attr,
bool &needsDestroy)
const;
306 void threadWrapper();
307 static void *threadEntry(
void *arg);
Portable thread owner abstraction for Dawn components.
bool isRunning() const
Check if the worker thread is running.
void setThreadScheduler(int scheduler)
Configure worker thread scheduler policy.
const CThreadedObject & workerThread() const
Get a const reference to this thread controller.
int threadStop()
Stop the worker thread.
virtual ~CThreadedObject()
Destructor - cleans up thread resources.
CThreadedObject()
Constructor - initializes thread management state.
size_t getThreadStackSize() const
Get configured worker thread stack size.
void setThreadStackSize(size_t stackSize)
Configure worker thread stack size.
static int THREAD_SCHEDULER_DEFAULT
Default scheduler behavior.
bool workerThreadRunning() const
Check if the worker thread is running.
const SThreadConfig & getThreadConfig() const
Get current thread configuration.
int threadStart()
Start the worker thread.
int getThreadScheduler() const
Get configured worker thread scheduler policy.
void setThreadFunc(Func &&func)
Assign the function executed by threadStart().
int stopWorkerThread()
Stop the worker thread.
int getThreadPriority() const
Get configured worker thread priority.
int startWorkerThread(Func &&func)
Start the worker thread with a given function.
void setThreadPriority(int priority)
Configure worker thread priority.
CThreadedObject & workerThread()
Get a reference to this thread controller.
static int THREAD_PRIORITY_DEFAULT
Default thread priority behavior.
void setThreadConfig(const SThreadConfig &config)
Replace the full thread configuration.
Out-of-tree user-extension hooks for Dawn.
Per-thread runtime configuration.
int priority
Requested thread priority (0 = creator default).
size_t stackSize
Requested stack size in bytes (0 = OS default).
int scheduler
Requested scheduler policy (-1 = creator default).