Now you can download a copy of these docs so you can use them offline! Download now

#include <Task.h>

Inheritance diagram for Task:
Collaboration diagram for Task:

Public Member Functions

 Task (const char *name, FUNCPTR function, INT32 priority=kDefaultPriority, UINT32 stackSize=20000)
bool Start (UINT32 arg0=0, UINT32 arg1=0, UINT32 arg2=0, UINT32 arg3=0, UINT32 arg4=0, UINT32 arg5=0, UINT32 arg6=0, UINT32 arg7=0, UINT32 arg8=0, UINT32 arg9=0)
bool Restart ()
bool Stop ()
bool IsReady ()
bool IsSuspended ()
bool Suspend ()
bool Resume ()
bool Verify ()
INT32 GetPriority ()
bool SetPriority (INT32 priority)
const char * GetName ()
INT32 GetID ()
- Public Member Functions inherited from ErrorBase
virtual ErrorGetError ()
 Retrieve the current error. Get the current error information associated with this sensor.
virtual const ErrorGetError () const
virtual void SetErrnoError (const char *contextMessage, const char *filename, const char *function, UINT32 lineNumber) const
 Set error information associated with a C library call that set an error to the "errno" global variable.
virtual void SetImaqError (int success, const char *contextMessage, const char *filename, const char *function, UINT32 lineNumber) const
 Set the current error information associated from the nivision Imaq API.
virtual void SetError (Error::Code code, const char *contextMessage, const char *filename, const char *function, UINT32 lineNumber) const
 Set the current error information associated with this sensor.
virtual void SetWPIError (const char *errorMessage, const char *contextMessage, const char *filename, const char *function, UINT32 lineNumber) const
 Set the current error information associated with this sensor.
virtual void CloneError (ErrorBase *rhs) const
virtual void ClearError () const
 Clear the current error information associated with this sensor.
virtual bool StatusIsFatal () const
 Check if the current error code represents a fatal error.

Static Public Attributes

static const UINT32 kDefaultPriority = 101
static const INT32 kInvalidTaskID = -1

Additional Inherited Members

- Static Public Member Functions inherited from ErrorBase
static void SetGlobalError (Error::Code code, const char *contextMessage, const char *filename, const char *function, UINT32 lineNumber)
static void SetGlobalWPIError (const char *errorMessage, const char *contextMessage, const char *filename, const char *function, UINT32 lineNumber)
static ErrorGetGlobalError ()
- Protected Member Functions inherited from ErrorBase
 ErrorBase ()
 Initialize the instance status to 0 for now.
- Protected Attributes inherited from ErrorBase
Error m_error
- Static Protected Attributes inherited from ErrorBase
static SEM_ID _globalErrorMutex = semMCreate(SEM_Q_PRIORITY | SEM_DELETE_SAFE | SEM_INVERSION_SAFE)
static Error _globalError

Detailed Description

WPI task is a wrapper for the native Task object. All WPILib tasks are managed by a static task manager for simplified cleanup.

Definition at line 17 of file Task.h.

Constructor & Destructor Documentation

Task::Task ( const char *  name,
FUNCPTR  function,
INT32  priority = kDefaultPriority,
UINT32  stackSize = 20000 
)

Create but don't launch a task.

Parameters
nameThe name of the task. "FRC_" will be prepended to the task name.
functionThe address of the function to run as the new task.
priorityThe VxWorks priority for the task.
stackSizeThe size of the stack for the task

Definition at line 26 of file Task.cpp.

Member Function Documentation

INT32 Task::GetID ( )

Get the ID of a task

Returns
Task ID of this task. Task::kInvalidTaskID (-1) if the task has not been started or has already exited.

Definition at line 175 of file Task.cpp.

const char * Task::GetName ( )

Returns the name of the task.

Returns
Pointer to the name of the task or NULL if not allocated

Definition at line 166 of file Task.cpp.

INT32 Task::GetPriority ( )

Gets the priority of a task.

Returns
task priority or 0 if an error occured

Definition at line 141 of file Task.cpp.

bool Task::IsReady ( )

Returns true if the task is ready to execute (i.e. not suspended, delayed, or blocked).

Returns
true if ready, false if not ready.

Definition at line 96 of file Task.cpp.

bool Task::IsSuspended ( )

Returns true if the task was explicitly suspended by calling Suspend()

Returns
true if suspended, false if not suspended.

Definition at line 105 of file Task.cpp.

bool Task::Restart ( )

Restarts a running task. If the task isn't started, it starts it.

Returns
false if the task is running and we are unable to kill the previous instance

Definition at line 72 of file Task.cpp.

bool Task::Resume ( )

Resumes a paused task. Returns true on success, false if unable to resume or if the task isn't running/paused.

Definition at line 123 of file Task.cpp.

bool Task::SetPriority ( INT32  priority)

This routine changes a task's priority to a specified priority. Priorities range from 0, the highest priority, to 255, the lowest priority. Default task priority is 100.

Parameters
priorityThe priority the task should run at.
Returns
true on success.

Definition at line 156 of file Task.cpp.

bool Task::Start ( UINT32  arg0 = 0,
UINT32  arg1 = 0,
UINT32  arg2 = 0,
UINT32  arg3 = 0,
UINT32  arg4 = 0,
UINT32  arg5 = 0,
UINT32  arg6 = 0,
UINT32  arg7 = 0,
UINT32  arg8 = 0,
UINT32  arg9 = 0 
)

Starts this task. If it is already running or unable to start, it fails and returns false.

Definition at line 52 of file Task.cpp.

bool Task::Stop ( )

Kills the running task.

Returns
true on success false if the task doesn't exist or we are unable to kill it.

Definition at line 81 of file Task.cpp.

bool Task::Suspend ( )

Pauses a running task. Returns true on success, false if unable to pause or the task isn't running.

Definition at line 114 of file Task.cpp.

bool Task::Verify ( )

Verifies a task still exists.

Returns
true on success.

Definition at line 132 of file Task.cpp.


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

Generated on Tue Feb 5 2013 00:55:11 for WPILibC++ by doxygen 1.8.1.2