WPILib 2012
WPILibRoboticsLibraryforFRC
|
#include <Task.h>
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 () |
Static Public Attributes | |
static const UINT32 | kDefaultPriority = 101 |
static const INT32 | kInvalidTaskID = -1 |
WPI task is a wrapper for the native Task object. All WPILib tasks are managed by a static task manager for simplified cleanup.
Task::Task | ( | const char * | name, |
FUNCPTR | function, | ||
INT32 | priority = kDefaultPriority , |
||
UINT32 | stackSize = 20000 |
||
) |
Create but don't launch a task.
name | The name of the task. "FRC" will be prepended to the task name. |
function | The address of the function to run as the new task. |
priority | The VxWorks priority for the task. |
stackSize | The size of the stack for the task |
INT32 Task::GetID | ( | ) |
Get the ID of a task
const char * Task::GetName | ( | ) |
Returns the name of the task.
INT32 Task::GetPriority | ( | ) |
Gets the priority of a task.
bool Task::IsReady | ( | ) |
Returns true if the task is ready to execute (i.e. not suspended, delayed, or blocked).
bool Task::IsSuspended | ( | ) |
Returns true if the task was explicitly suspended by calling Suspend()
bool Task::Restart | ( | ) |
Restarts a running task. If the task isn't started, it starts it.
bool Task::Resume | ( | ) |
Resumes a paused task. Returns true on success, false if unable to resume or if the task isn't running/paused.
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.
priority | The priority the task should run at. |
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.
bool Task::Stop | ( | ) |
Kills the running task.
bool Task::Suspend | ( | ) |
Pauses a running task. Returns true on success, false if unable to pause or the task isn't running.
bool Task::Verify | ( | ) |
Verifies a task still exists.