oveRTOS C++ API
C++20 RAII wrappers for the oveRTOS C API
Loading...
Searching...
No Matches
Public Member Functions | List of all members
ove::Workqueue< StackSize > Class Template Reference

RAII wrapper around an oveRTOS workqueue (dedicated worker thread). More...

#include <workqueue.hpp>

Public Member Functions

 Workqueue (const char *name, ove_prio_t prio)
 Constructs and starts the workqueue.
 
 ~Workqueue ()
 Destroys the workqueue and terminates the worker thread.
 
 Workqueue (const Workqueue &)=delete
 
Workqueueoperator= (const Workqueue &)=delete
 
 Workqueue (Workqueue &&other) noexcept
 Move constructor — transfers ownership of the kernel handle.
 
Workqueueoperator= (Workqueue &&other) noexcept
 Move-assignment operator — transfers ownership of the kernel handle.
 
bool valid () const
 Returns true if the underlying kernel handle is non-null.
 
ove_workqueue_t handle () const
 Returns the raw oveRTOS workqueue handle.
 

Detailed Description

template<size_t StackSize = 0>
class ove::Workqueue< StackSize >

RAII wrapper around an oveRTOS workqueue (dedicated worker thread).

A workqueue owns a worker thread that executes Work items submitted to it. Items are processed serially in FIFO order.

Template Parameters
StackSizeStack size in bytes for the worker thread (must be > 0).
Note
Not copyable. Move-only when heap allocation is enabled.

Constructor & Destructor Documentation

◆ Workqueue() [1/2]

template<size_t StackSize = 0>
ove::Workqueue< StackSize >::Workqueue ( const char *  name,
ove_prio_t  prio 
)
inline

Constructs and starts the workqueue.

Only participates in overload resolution when StackSize > 0.

Parameters
[in]nameHuman-readable name for the worker thread.
[in]prioPriority of the worker thread.

Asserts at startup if initialisation fails.

◆ Workqueue() [2/2]

template<size_t StackSize = 0>
ove::Workqueue< StackSize >::Workqueue ( Workqueue< StackSize > &&  other)
inlinenoexcept

Move constructor — transfers ownership of the kernel handle.

Parameters
otherThe source; its handle is set to null after the move.

Member Function Documentation

◆ operator=()

template<size_t StackSize = 0>
Workqueue & ove::Workqueue< StackSize >::operator= ( Workqueue< StackSize > &&  other)
inlinenoexcept

Move-assignment operator — transfers ownership of the kernel handle.

Parameters
otherThe source; its handle is set to null after the move.
Returns
Reference to this object.

◆ valid()

template<size_t StackSize = 0>
bool ove::Workqueue< StackSize >::valid ( ) const
inline

Returns true if the underlying kernel handle is non-null.

Returns
true when the workqueue was successfully initialised.

◆ handle()

template<size_t StackSize = 0>
ove_workqueue_t ove::Workqueue< StackSize >::handle ( ) const
inline

Returns the raw oveRTOS workqueue handle.

Returns
The opaque ove_workqueue_t handle.

The documentation for this class was generated from the following file: