F´ Flight Software - C/C++ Documentation NASA-v1.6.0
A framework for building embedded system applications to NASA flight quality standards.
Loading...
Searching...
No Matches
Os::Task Class Reference

forward declaration More...

#include <Os/Task.hpp>

Classes

struct  TaskRoutineWrapper
 

Public Types

enum  TaskStatus {
  TASK_OK , TASK_INVALID_PARAMS , TASK_INVALID_STACK , TASK_UNKNOWN_ERROR ,
  TASK_INVALID_AFFINITY , TASK_DELAY_ERROR , TASK_JOIN_ERROR , TASK_ERROR_RESOURCES ,
  TASK_ERROR_PERMISSION
}
 
typedef void(* taskRoutine) (void *ptr)
 prototype for task routine started in task context
 

Public Member Functions

 Task ()
 constructor
 
virtual ~Task ()
 destructor
 
TaskStatus start (const Fw::StringBase &name, taskRoutine routine, void *arg, NATIVE_UINT_TYPE priority=TASK_DEFAULT, NATIVE_UINT_TYPE stackSize=TASK_DEFAULT, NATIVE_UINT_TYPE cpuAffinity=TASK_DEFAULT, NATIVE_UINT_TYPE identifier=TASK_DEFAULT)
 start the task
 
 DEPRECATED (TaskStatus start(const Fw::StringBase &name, NATIVE_INT_TYPE identifier, NATIVE_INT_TYPE priority, NATIVE_INT_TYPE stackSize, taskRoutine routine, void *arg, NATIVE_INT_TYPE cpuAffinity=static_cast< NATIVE_INT_TYPE >(TASK_DEFAULT)), "Please switch to start(Fw::StringBase &name, taskRoutine routine, void* arg, NATIVE_UINT_TYPE priority, NATIVE_UINT_TYPE stackSize, NATIVE_UINT_TYPE cpuAffinity, NATIVE_UINT_TYPE identifier)")
 start the task
 
I32 getIdentifier ()
 get the identifier for the task
 
TaskStatus join (void **value_ptr)
 Wait for task to finish.
 
void suspend (bool onPurpose=false)
 suspend task
 
void resume ()
 resume execution of task
 
bool wasSuspended ()
 returns whether or not task was suspended on purpose
 
bool isSuspended ()
 check with OS to see if it is suspended already
 
bool isStarted ()
 check to see if task is started
 
void setStarted (bool started)
 set task to started when thread is fully up. Avoids a VxWorks race condition.
 
POINTER_CAST getRawHandle ()
 

Static Public Member Functions

static TaskId getOsIdentifier ()
 
static TaskStatus delay (NATIVE_UINT_TYPE msecs)
 delay the task
 
static NATIVE_INT_TYPE getNumTasks ()
 
static void registerTaskRegistry (TaskRegistry *registry)
 

Static Public Attributes

static const NATIVE_UINT_TYPE TASK_DEFAULT = std::numeric_limits<PlatformUIntType>::max()
 

Detailed Description

forward declaration

Definition at line 15 of file Task.hpp.

Member Typedef Documentation

◆ taskRoutine

typedef void(* Os::Task::taskRoutine) (void *ptr)

prototype for task routine started in task context

Definition at line 30 of file Task.hpp.

Member Enumeration Documentation

◆ TaskStatus

Enumerator
TASK_OK 

message sent/received okay

TASK_INVALID_PARAMS 

started task with invalid parameters

TASK_INVALID_STACK 

started with invalid stack size

TASK_UNKNOWN_ERROR 

unexpected error return value

TASK_INVALID_AFFINITY 

unable to set the task affinity

TASK_DELAY_ERROR 

error trying to delay the task

TASK_JOIN_ERROR 

error trying to join the task

TASK_ERROR_RESOURCES 

unable to allocate more tasks

TASK_ERROR_PERMISSION 

permissions error setting-up tasks

Definition at line 18 of file Task.hpp.

Constructor & Destructor Documentation

◆ Task()

Os::Task::Task ( )

constructor

Definition at line 10 of file Task.cpp.

◆ ~Task()

Os::Task::~Task ( )
virtual

destructor

Definition at line 49 of file Task.cpp.

Member Function Documentation

◆ delay()

Task::TaskStatus Os::Task::delay ( NATIVE_UINT_TYPE  msecs)
static

delay the task

Definition at line 43 of file Task.cpp.

◆ DEPRECATED()

Os::Task::DEPRECATED ( TaskStatus   startconst Fw::StringBase &name, NATIVE_INT_TYPE identifier, NATIVE_INT_TYPE priority, NATIVE_INT_TYPE stackSize, taskRoutine routine, void *arg, NATIVE_INT_TYPE cpuAffinity=static_cast< NATIVE_INT_TYPE >(TASK_DEFAULT),
"Please switch to start(Fw::StringBase &name, taskRoutine routine, void* arg, NATIVE_UINT_TYPE priority, NATIVE_UINT_TYPE stackSize, NATIVE_UINT_TYPE cpuAffinity, NATIVE_UINT_TYPE identifier)"   
)

start the task

◆ getIdentifier()

I32 Os::Task::getIdentifier ( )

get the identifier for the task

Definition at line 17 of file TaskCommon.cpp.

◆ getNumTasks()

NATIVE_INT_TYPE Os::Task::getNumTasks ( )
static

Definition at line 12 of file TaskCommon.cpp.

◆ getOsIdentifier()

TaskId Os::Task::getOsIdentifier ( )
static

Definition at line 295 of file Task.cpp.

◆ getRawHandle()

POINTER_CAST Os::Task::getRawHandle ( )

Returns the task-handle owned by this task

Definition at line 33 of file TaskCommon.cpp.

◆ isStarted()

bool Os::Task::isStarted ( )

check to see if task is started

Definition at line 21 of file TaskCommon.cpp.

◆ isSuspended()

bool Os::Task::isSuspended ( )

check with OS to see if it is suspended already

Definition at line 69 of file Task.cpp.

◆ join()

Task::TaskStatus Os::Task::join ( void **  value_ptr)

Wait for task to finish.

Definition at line 74 of file Task.cpp.

◆ registerTaskRegistry()

void Os::Task::registerTaskRegistry ( TaskRegistry registry)
static

Definition at line 37 of file TaskCommon.cpp.

◆ resume()

void Os::Task::resume ( )

resume execution of task

Definition at line 64 of file Task.cpp.

◆ setStarted()

void Os::Task::setStarted ( bool  started)

set task to started when thread is fully up. Avoids a VxWorks race condition.

Definition at line 25 of file TaskCommon.cpp.

◆ start()

Task::TaskStatus Os::Task::start ( const Fw::StringBase name,
taskRoutine  routine,
void *  arg,
NATIVE_UINT_TYPE  priority = TASK_DEFAULT,
NATIVE_UINT_TYPE  stackSize = TASK_DEFAULT,
NATIVE_UINT_TYPE  cpuAffinity = TASK_DEFAULT,
NATIVE_UINT_TYPE  identifier = TASK_DEFAULT 
)

start the task

Definition at line 18 of file Task.cpp.

◆ suspend()

void Os::Task::suspend ( bool  onPurpose = false)

suspend task

Definition at line 59 of file Task.cpp.

◆ wasSuspended()

bool Os::Task::wasSuspended ( )

returns whether or not task was suspended on purpose

Definition at line 29 of file TaskCommon.cpp.

Member Data Documentation

◆ TASK_DEFAULT

const NATIVE_UINT_TYPE Os::Task::TASK_DEFAULT = std::numeric_limits<PlatformUIntType>::max()
static

Definition at line 17 of file Task.hpp.


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