Class anira::HighPriorityThread#

class HighPriorityThread#

Deprecated: use thl::core::Thread (tanh-lib) with thl::core::ThreadPriority::RealTime.

The platform priority handling that lived here moved to tanh-lib’s thl::core::Thread, which anira’s own InferenceThread now uses. This class remains for one minor release as a thin wrapper with the old interface: derive, implement run(), call start()/stop(). It will be removed afterwards.

Deprecated:

Use thl::core::Thread. For elevating a thread you did not create (elevate_priority()), use thl::core::Thread::set_current_priority().

Warning

A derived class must call stop() in its own destructor. This class’s destructor also calls it, but a base destructor runs only after the derived part of the object has been destroyed — so a worker still executing run() would touch members that no longer exist. Relying on ~HighPriorityThread() alone is undefined behaviour for any run() that reads or writes the derived object’s own state.

Public Functions

HighPriorityThread() = default#
inline virtual ~HighPriorityThread()#
HighPriorityThread(const HighPriorityThread&) = delete#
HighPriorityThread &operator=(const HighPriorityThread&) = delete#
inline void start()#

Starts an OS thread at real-time priority that calls run().

inline void stop()#

Signals run() to return (should_exit()) and joins the thread.

virtual void run() = 0#
inline bool should_exit()#
inline bool is_running()#

Public Static Functions

static inline void elevate_priority(std::thread::native_handle_type, bool = false)#

Applies real-time priority to the calling thread.

The handle is ignored (the platform APIs that matter act on the calling thread); call this from the thread to elevate. is_main_process is ignored.

Deprecated:

Use thl::core::Thread::set_current_priority(ThreadPriority::RealTime).