VxWorks Reference Manual : Libraries
taskInfo - task information library
taskOptionsSet( ) - change task options
taskOptionsGet( ) - examine task options
taskRegsGet( ) - get a task's registers from the TCB
taskRegsSet( ) - set a task's registers
taskName( ) - get the name associated with a task ID
taskNameToId( ) - look up the task ID associated with a task name
taskIdDefault( ) - set the default task ID
taskIsReady( ) - check if a task is ready to run
taskIsSuspended( ) - check if a task is suspended
taskIdListGet( ) - get a list of active task IDs
This library provides a programmatic interface for obtaining task information.
Task information is crucial as a debugging aid and user-interface convenience during the development cycle of an application. The routines taskOptionsGet( ), taskRegsGet( ), taskName( ), taskNameToId( ), taskIsReady( ), taskIsSuspended( ), and taskIdListGet( ) are used to obtain task information. Three routines -- taskOptionsSet( ), taskRegsSet( ), and taskIdDefault( ) -- provide programmatic access to debugging features.
The chief drawback of using task information is that tasks may change their state between the time the information is gathered and the time it is utilized. Information provided by these routines should therefore be viewed as a snapshot of the system, and not relied upon unless the task is consigned to a known state, such as suspended.
Task management and control routines are provided by taskLib. Higher-level task information display routines are provided by taskShow.
taskLib.h
taskInfo, taskLib, taskShow, taskHookLib, taskVarLib, semLib, kernelLib, VxWorks Programmer's Guide: Basic OS
taskOptionsSet( ) - change task options
STATUS taskOptionsSet ( int tid, /* task ID */ int mask, /* bit mask of option bits to unset */ int newOptions /* bit mask of option bits to set */ )
This routine changes the execution options of a task. The only option that can be changed after a task has been created is:
- VX_UNBREAKABLE
- do not allow breakpoint debugging.
For definitions, see taskLib.h.
OK, or ERROR if the task ID is invalid.
taskOptionsGet( ) - examine task options
STATUS taskOptionsGet ( int tid, /* task ID */ int * pOptions /* task's options */ )
This routine gets the current execution options of the specified task. The option bits returned by this routine indicate the following modes:
- VX_FP_TASK
- execute with floating-point coprocessor support.
- VX_PRIVATE_ENV
- include private environment support (see envLib).
- VX_NO_STACK_FILL
- do not fill the stack for use by checkstack( ).
- VX_UNBREAKABLE
- do not allow breakpoint debugging.
For definitions, see taskLib.h.
OK, or ERROR if the task ID is invalid.
taskRegsGet( ) - get a task's registers from the TCB
STATUS taskRegsGet ( int tid, /* task ID */ REG_SET * pRegs /* put register contents here */ )
This routine gathers task information kept in the TCB. It copies the contents of the task's registers to the register structure pRegs.
This routine only works well if the task is known to be in a stable, non-executing state. Self-examination, for instance, is not advisable, as results are unpredictable.
OK, or ERROR if the task ID is invalid.
taskInfo, taskSuspend( ), taskRegsSet( )
taskRegsSet( ) - set a task's registers
STATUS taskRegsSet ( int tid, /* task ID */ REG_SET * pRegs /* get register contents from here */ )
This routine loads a specified register set pRegs into a specified task's TCB.
This routine only works well if the task is known not to be in the ready state. Suspending the task before changing the register set is recommended.
OK, or ERROR if the task ID is invalid.
taskInfo, taskSuspend( ), taskRegsGet( )
taskName( ) - get the name associated with a task ID
char *taskName ( int tid /* ID of task whose name is to be found */ )
This routine returns a pointer to the name of a task of a specified ID, if the task has a name. If the task has no name, it returns an empty string.
A pointer to the task name, or NULL if the task ID is invalid.
taskNameToId( ) - look up the task ID associated with a task name
int taskNameToId ( char * name /* task name to look up */ )
This routine returns the ID of the task matching a specified name. Referencing a task in this way is inefficient, since it involves a search of the task list.
The task ID, or ERROR if the task is not found.
S_taskLib_NAME_NOT_FOUND
taskIdDefault( ) - set the default task ID
int taskIdDefault ( int tid /* user supplied task ID; if 0, return default */ )
This routine maintains a global default task ID. This ID is used by libraries that want to allow a task ID argument to take on a default value if the user did not explicitly supply one.
If tid is not zero (i.e., the user did specify a task ID), the default ID is set to that value, and that value is returned. If tid is zero (i.e., the user did not specify a task ID), the default ID is not changed and its value is returned. Thus the value returned is always the last task ID the user specified.
The most recent non-zero task ID.
taskInfo, dbgLib, VxWorks Programmer's Guide: Target Shell, windsh, Tornado User's Guide: Shell
taskIsReady( ) - check if a task is ready to run
BOOL taskIsReady ( int tid /* task ID */ )
This routine tests the status field of a task to determine if it is ready to run.
TRUE if the task is ready, otherwise FALSE.
taskIsSuspended( ) - check if a task is suspended
BOOL taskIsSuspended ( int tid /* task ID */ )
This routine tests the status field of a task to determine if it is suspended.
TRUE if the task is suspended, otherwise FALSE.
taskIdListGet( ) - get a list of active task IDs
int taskIdListGet ( int idList[], /* array of task IDs to be filled in */ int maxTasks /* max tasks idList can accommodate */ )
This routine provides the calling task with a list of all active tasks. An unsorted list of task IDs for no more than maxTasks tasks is put into idList.
Kernel rescheduling is disabled with taskLock( ) while tasks are filled into the idList. There is no guarantee that all the tasks are valid or that new tasks have not been created by the time this routine returns.
The number of tasks put into the ID list.