77 void*
const routine_argument =
nullptr,
81 const PlatformUIntType identifier = static_cast<PlatformUIntType>(
TASK_DEFAULT));
158 virtual void resume() = 0;
209 static void run(
void* task_pointer);
232 Task& operator=(const
Task& other) = delete;
368 static
Mutex s_taskMutex;
376 bool m_registered = false;
395 virtual void addTask(
Task* task) = 0;
400 virtual void removeTask(
Task* task) = 0;
error trying to join the task
static Status delay(Fw::TimeInterval interval)
delay the current task
virtual ~TaskInterface()=default
default virtual destructor
static constexpr FwSizeType TASK_DEFAULT
TaskHandle * getHandle() override
return the underlying task handle (implementation specific)
Task handle representation.
unable to set the task affinity
PlatformSizeType FwSizeType
virtual void resume()=0
resume a suspended task
static Task & getSingleton()
get a reference to singleton
PlatformUIntType m_identifier
Task is in an invalid state for the operation.
virtual Status _delay(Fw::TimeInterval interval)=0
delay the currently scheduled task using the given architecture
State getState()
get the task's state
started task with invalid parameters
static void registerTaskRegistry(TaskRegistry *registry)
register a task registry to track Threads
A class to represent a time interval holding two U32 seconds and microseconds values.
started with invalid stack size
permissions error setting-up tasks
Task()
default constructor
Status start(const Arguments &arguments) override
start the task
Status _delay(Fw::TimeInterval interval) override
delay the current task
virtual Status join()=0
block until the task has ended
~Task() final
default virtual destructor
U8 TaskHandleStorage[FW_TASK_HANDLE_MAX_SIZE]
virtual void onStart()=0
perform required task start actions
void * m_user_argument
Argument to user function.
void * m_routine_argument
Arguments(const Fw::StringBase &name, const taskRoutine routine, void *const routine_argument=nullptr, const FwSizeType priority=TASK_DEFAULT, const FwSizeType stackSize=TASK_DEFAULT, const FwSizeType cpuAffinity=TASK_DEFAULT, const PlatformUIntType identifier=static_cast< PlatformUIntType >(TASK_DEFAULT))
construct a set of arguments to start a task
error trying to delay the task
static TaskInterface * getDelegate(TaskHandleStorage &aligned_placement_new_memory)
provide a pointer to a task delegate object
bool isCooperative() override
determine if the task is cooperative multitasking (implementation specific)
FwSizeType getPriority()
get the task priority
DEPRECATED(Status start(const Fw::StringBase &name, const taskRoutine routine, void *const arg=nullptr, const ParamType priority=TASK_DEFAULT, const ParamType stackSize=TASK_DEFAULT, const ParamType cpuAffinity=TASK_DEFAULT, const ParamType identifier=TASK_DEFAULT), "Switch to Task::start(Arguments&)")
start this task
virtual void suspend(SuspensionType suspensionType)=0
suspend the task given the suspension type
unexpected error return value
message sent/received okay
virtual Status start(const Arguments &arguments)=0
start the task
void suspend()
suspend the current task
Status join() override
block until the task has ended
static FwSizeType getNumTasks()
get the current number of tasks
TaskInterface()=default
default constructor
static void run(void *task_pointer)
run the task routine wrapper
Wrapper for task routine that ensures onStart() is called once the task actually begins.
Task & m_task
Reference to owning task.
const Os::TaskString m_name
FwSizeType ParamType
backwards-compatible parameter type
void onStart() override
perform delegate's required task start actions
TaskRoutineWrapper(Task &self)
void invokeRoutine()
invoke the task's routine
Task feature is not supported.
void resume() override
resume a suspended task
void invoke()
invoke the run method with "self" as argument
unable to allocate more tasks
TaskInterface & operator=(const TaskInterface &other)=delete
assignment operator is forbidden
taskRoutine m_user_function
User function to run once started.
static void init()
initialize singleton
#define FW_HANDLE_ALIGNMENT
Alignment of handle storage.
virtual TaskHandle * getHandle()=0
return the underlying task handle (implementation specific)
void(* taskRoutine)(void *ptr)
Prototype for task routine started in task context.
virtual bool isCooperative()
determine if the task requires cooperative multitasking