F´ Flight Software - C/C++ Documentation
devel
A framework for building embedded system applications to NASA flight quality standards.
|
#include <Os/Task.hpp>
Classes | |
class | Arguments |
Public Types | |
enum | Status { OP_OK , INVALID_HANDLE , INVALID_PARAMS , INVALID_STACK , UNKNOWN_ERROR , INVALID_AFFINITY , DELAY_ERROR , JOIN_ERROR , ERROR_RESOURCES , ERROR_PERMISSION , INVALID_STATE } |
enum | SuspensionType { INTENTIONAL , UNINTENTIONAL } |
enum | State { NOT_STARTED , STARTING , RUNNING , SUSPENDED_INTENTIONALLY , SUSPENDED_UNINTENTIONALLY , EXITED , UNKNOWN } |
typedef void(* | taskRoutine) (void *ptr) |
Prototype for task routine started in task context. More... | |
Public Member Functions | |
TaskInterface ()=default | |
default constructor More... | |
virtual | ~TaskInterface ()=default |
default virtual destructor More... | |
TaskInterface (const TaskInterface &other)=delete | |
copy constructor is forbidden More... | |
TaskInterface & | operator= (const TaskInterface &other)=delete |
assignment operator is forbidden More... | |
virtual void | onStart ()=0 |
perform required task start actions More... | |
virtual Status | join ()=0 |
block until the task has ended More... | |
virtual void | suspend (SuspensionType suspensionType)=0 |
suspend the task given the suspension type More... | |
virtual void | resume ()=0 |
resume a suspended task More... | |
virtual Status | _delay (Fw::TimeInterval interval)=0 |
delay the currently scheduled task using the given architecture More... | |
virtual bool | isCooperative () |
determine if the task requires cooperative multitasking More... | |
virtual TaskHandle * | getHandle ()=0 |
return the underlying task handle (implementation specific) More... | |
virtual Status | start (const Arguments &arguments)=0 |
start the task More... | |
Static Public Member Functions | |
static TaskInterface * | getDelegate (TaskHandleStorage &aligned_placement_new_memory) |
provide a pointer to a task delegate object More... | |
Static Public Attributes | |
static constexpr FwSizeType | TASK_DEFAULT = std::numeric_limits<FwSizeType>::max() |
typedef void(* Os::TaskInterface::taskRoutine) (void *ptr) |
Enumerator | |
---|---|
OP_OK | message sent/received okay |
INVALID_HANDLE | Task handle invalid. |
INVALID_PARAMS | started task with invalid parameters |
INVALID_STACK | started with invalid stack size |
UNKNOWN_ERROR | unexpected error return value |
INVALID_AFFINITY | unable to set the task affinity |
DELAY_ERROR | error trying to delay the task |
JOIN_ERROR | error trying to join the task |
ERROR_RESOURCES | unable to allocate more tasks |
ERROR_PERMISSION | permissions error setting-up tasks |
INVALID_STATE | Task is in an invalid state for the operation. |
|
default |
default constructor
|
virtualdefault |
default virtual destructor
|
delete |
copy constructor is forbidden
|
pure virtual |
delay the currently scheduled task using the given architecture
Delays, or sleeps, the current task by the supplied time interval. In non-preempting os implementations the task will resume no earlier than expected but an exact wake-up time is not guaranteed.
interval | delay time |
Implemented in Os::Task, Os::Stub::Task::StubTask, and Os::Posix::Task::PosixTask.
|
static |
provide a pointer to a task delegate object
This function must return a pointer to a TaskInterface
object that contains the real implementation of the file functions as defined by the implementor. This function must do several things to be considered correctly implemented:
FW_ASSERT(aligned_placement_new_memory != NULL);
static_assert(sizeof(PosixTaskImplementation) <= sizeof Os::Task::m_handle_storage, "FW_HANDLE_MAX_SIZE to small");
static_assert((FW_HANDLE_ALIGNMENT % alignof(PosixTaskImplementation)) == 0, "Bad handle alignment");
aligned_placement_new_memory
e.g. TaskInterface* interface = new (aligned_placement_new_memory) PosixTaskImplementation;
return interface;
aligned_placement_new_memory
Definition at line 11 of file DefaultTask.cpp.
|
pure virtual |
return the underlying task handle (implementation specific)
Implemented in Os::Task, Os::Stub::Task::StubTask, and Os::Posix::Task::PosixTask.
|
virtual |
determine if the task requires cooperative multitasking
Some task implementations require cooperative multitasking where the task execution is run by a user defined task scheduler and not the operating system task scheduler. These tasks cooperatively on multitask by doing one unit of work and return from the function.
This function indicates if the task requires cooperative support. The default implementation returns false.
Reimplemented in Os::Task, and Os::Stub::Task::StubTask.
|
pure virtual |
block until the task has ended
Blocks the current (calling) task until this task execution has ended. Callers should ensure that any signals required to stop this task have already been emitted or will be emitted by another task.
Implemented in Os::Task, Os::Stub::Task::StubTask, and Os::Posix::Task::PosixTask.
|
pure virtual |
perform required task start actions
Implemented in Os::Task, Os::Stub::Task::StubTask, and Os::Posix::Task::PosixTask.
|
delete |
assignment operator is forbidden
|
pure virtual |
resume a suspended task
Resumes this task. Not started, running, and exited tasks take no action.
Implemented in Os::Task, Os::Stub::Task::StubTask, and Os::Posix::Task::PosixTask.
start the task
Starts the task given the supplied arguments.
arguments | arguments supplied to the task start call |
Implemented in Os::Task, Os::Stub::Task::StubTask, and Os::Posix::Task::PosixTask.
|
pure virtual |
suspend the task given the suspension type
Suspends the task. Some implementations track if the suspension of a task was intentional or unintentional. The supplied suspensionType
parameter indicates that this was intentional or unintentional. The type of suspension is also returned when calling isSuspended
.
suspensionType | intentionality of the suspension |
Implemented in Os::Task, Os::Stub::Task::StubTask, and Os::Posix::Task::PosixTask.
|
staticconstexpr |