Class anira::InferenceThread#
-
class InferenceThread#
An inference thread the host drives (anira_inference_thread of anira/abi/thread.h), for a context configured with no pool threads (ContextConfig::threads(0)): start() runs the loop on a thread of anira’s, or the host calls run_loop() or execute() on a thread of its own. Move-only; the destructor is anira_inference_thread_destroy, which natively stops and joins a started thread first (on WebAssembly the thread must have left its loop: stop(), then wait for has_exited()).
Public Functions
-
inline explicit InferenceThread(Context &context)#
- Throws:
Error – with the status of anira_inference_thread_create.
-
inline ~InferenceThread()#
-
InferenceThread(const InferenceThread&) = delete#
-
InferenceThread &operator=(const InferenceThread&) = delete#
-
inline InferenceThread(InferenceThread &&other) noexcept#
-
inline InferenceThread &operator=(InferenceThread &&other) noexcept#
-
inline void start()#
anira_inference_thread_start: the loop on a real-time thread of anira’s.
- Throws:
Error – when the thread cannot be started.
-
inline void stop() noexcept#
anira_inference_thread_stop: asks the loop to return and joins the thread start() started (WebAssembly: waits for its Worker to leave the loop); a run_loop() on a thread of the host’s is asked to return only (poll has_exited()).
-
inline bool execute() noexcept#
anira_inference_thread_execute: one dequeue on the caller’s thread; whether it ran one.
-
inline void run_loop() noexcept#
anira_inference_thread_run_loop: the loop on the caller’s thread, until stop().
-
inline bool should_exit() const noexcept#
-
inline bool is_running() const noexcept#
-
inline bool has_exited() const noexcept#
-
inline const anira_inference_thread *native() const noexcept#
-
inline anira_inference_thread *native() noexcept#
-
inline explicit InferenceThread(Context &context)#