GLAST/LAT > DAQ and FSW > FSW > Doxygen Index > PBS / V2-10-10
Constituent: pbs     Tag: sun-gcc
#include <errno.h>
#include <stdio.h>
#include "PBS/BUG.h"
#include <sched.h>
#include <semaphore.h>
Include dependency graph for TASK.c.px-xxx-xxx:
Functions | |
void * | TASK_wrapper (TASK_tcb *tcb) |
Pseudo entry to launch the user's routine from. | |
int | TASK_tcb_sizeof (void) |
Returns the size, in bytes, of a TCB to be used when creating or spawning a TASK. | |
int | TASK_sys_init (void) |
Performs one time only initialization of the TASK facility. | |
int | TASK_sys_shutdown (void) |
Performs the shutdown of the TASK facility. This essentially undoes what TASK_sys_init did. | |
int | TASK_xtcb_sizeof () |
Returns the size, in bytes, of a TCB to be used when converting an existing (platform native task) to a TASK type task. | |
int | TASK_activate (TASK_tcb *tcb) |
Activates a previously created task. | |
int | TASK_create (TASK_tcb *tcb, const TASK_attr *attributes, TASK_entry entry_point, TASK_parameter parameter) |
Creates, but does not activate a task. | |
int | TASK_convert (TASK_tcb *tcb, const TASK_attr *attributes, TASK_entry entry_point, TASK_parameter parameter) |
Converts an existing VxWorks task to a TASK. | |
int | TASK_revert (TASK_tcb *tcb) |
Strips a task/thread of its TASK functionality. | |
void | TASK_exit (void *exit_value) |
Causes the calling task to delete itself and allows notification to another task, via TASK_join() that the calling task has deleted itself. | |
const char * | TASK_name (const TASK_tcb *tcb) |
Returns a pointer to the task's name. | |
int | TASK_join (TASK_tcb *tcb, void **exit_value) |
Blocks the calling task until the specified task completes. | |
int | TASK_spawn (TASK_tcb *tcb, const TASK_attr *attributes, TASK_entry entry_point, TASK_parameter parameter) |
Convenience routine to both create and activate a task. | |
int | TASK_destroy (TASK_tcb *tcb) |
Destroys, ie deletes, a previously created task. | |
int | TASK_resume (TASK_tcb *tcb) |
Resumes a previously suspended task. | |
int | TASK_suspend (TASK_tcb *tcb) |
Suspends a task. | |
int | TASK_wait (const TOV tov) |
Causes the calling task to wait (pause) until the specified timeout is reached. | |
int | TASK_priority_get (const TASK_tcb *tcb) |
Gets the current priority of the specified task. The priority is returned expressed in the native tasking model's scheme. | |
int | TASK_priority_set (TASK_tcb *tcb, int priority) |
Sets priority of the specified task to the specified value. | |
int | TASK_block (TASK_block_handle *tbh, TASK_block_cb rtn, void *prm) |
Provides a simple way to turn an asynchronous routine into a synchronous routine. | |
int | TASK_unblock (TASK_block_handle tbh) |
Unblocks a task blocked on a call to TASK_block. |
CVS $Id: TASK.c.px-xxx-xxx,v 1.9 2004/10/20 14:36:53 russell Exp $
|
Activates a previously created task.
|
|
Provides a simple way to turn an asynchronous routine into a synchronous routine.
struct Synch { TASK_block_handle tbh; char buf[100]; void nbytes; SynchRtn synch_rtn; } synch; synch->synch_rtn = read_synch; status = TASK_block (&synch->tbh, read_it, &synch);
int read_synch (Synch *synch) { return TASK_unblock (synch->tbh); } |
|
Converts an existing VxWorks task to a TASK.
nbytes = TASK_xtcb_sizeof (); // Get the size of a conversion block tcb = MBA_alloc (nbytes); // Allocate memory for it // Give control to TASK, it will just call (*myRoutine)(myParameter) // then return when that routine is down status = TASK_convert (tcb, NULL, myRoutine, myParameter); // Strip this task of TASK functionality status = TASK_revert (tcb); // Return the TASK resources MBA_free (tcb); // Free the memory for the tcb The second usage is when doing informal coding in the shell.
nbytes = TASK_xtcb_sizeof (); // Get the size of a conversion block tcb = MBA_alloc (nbytes); // Allocate memory for it // Just create and initialize the tcb status = TASK_convert (tcb, NULL, NULL, NULL); ... lots of code // Strip this task of TASK functionality status = TASK_revert (tcb); // Return the TASK resources MBA_free (tcb); // Free the memory for the tcb Naturally the above example (the one without the user callback routine can be used in the other case also, but, style-wise, usage of the calback is structurally cleaner.
|
|
Creates, but does not activate a task.
|
|
Destroys, ie deletes, a previously created task.
|
|
Causes the calling task to delete itself and allows notification to another task, via TASK_join() that the calling task has deleted itself.
Note that the status value is a void *, so a pointer to any piece of information can be supplied with the usual caveat that the memory the pointer is aimed at remains valid until read. |
|
Blocks the calling task until the specified task completes.
|
|
Returns a pointer to the task's name.
|
|
Gets the current priority of the specified task. The priority is returned expressed in the native tasking model's scheme.
|
|
Sets priority of the specified task to the specified value.
|
|
Resumes a previously suspended task.
|
|
Strips a task/thread of its TASK functionality.
Although this call can be used with TASK_create() and TASK_spawn(), it is most usually called after TASK_convert(). |
|
Convenience routine to both create and activate a task.
|
|
Suspends a task.
|
|
Performs one time only initialization of the TASK facility.
|
|
Performs the shutdown of the TASK facility. This essentially undoes what TASK_sys_init did.
|
|
Returns the size, in bytes, of a TCB to be used when creating or spawning a TASK.
|
|
Unblocks a task blocked on a call to TASK_block.
|
|
Causes the calling task to wait (pause) until the specified timeout is reached.
|
|
Pseudo entry to launch the user's routine from.
Another design decision could have been to abandon the concept of task/thread creation without activation. In VxWorks, this concept proves useful when debugging. If there is an error in the task's initialization code, one needs to create the task first, then attach the debugger before activating the task. The ordering is important, since the debugger attachs by the task's id (TID). This must exist before it can be used. |
|
Returns the size, in bytes, of a TCB to be used when converting an existing (platform native task) to a TASK type task.
|