Main Page | Modules | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

task.h: Task/Process operations
[platform independant portions of code]


Typedefs

typedef enum _TaskType TaskType
typedef enum _TaskState TaskState
typedef enum _TaskWaitingOn TaskWaitingOn
typedef _Task * Task

Enumerations

enum  _TaskType { TaskTypeOS = 0, TaskTypeUser }
enum  _TaskState { TaskStateDead, TaskStateAlive, TaskStateWaiting, TaskStateTimedOut }
enum  _TaskWaitingOn { TaskWaitingOnMutex, TaskWaitingOnSemaphore, TaskWaitingOnDelay }

Functions

ErrorCode taskCreate (Task *task, Task parent, String name, void(*entry)(void *), void *argument, TaskType type, uint32 stackSize, uint8 priority)
ErrorCode taskDestroy (Task *task)
ErrorCode taskGetCurrent (Task *task)
ErrorCode taskGetState (Task task, TaskState *state)
ErrorCode taskSetState (Task task, TaskState state)
ErrorCode taskGetMessageQueue (Task task, MessageQueue *queue)
ErrorCode taskSetTimeout (Task task, Timeout to)
ErrorCode taskForceSwitch (void)
ErrorCode taskPrintStackTrace (Task task)
ErrorCode taskGetStackPointer (Task task, Pointer *ptr)
ErrorCode taskGetStackBase (Task task, Pointer *ptr)
ErrorCode taskGetStackSize (Task task, uint32 *size)
ErrorCode taskGetStackDirection (int32 *direction)

Detailed Description

This file defines the portable interface to the platforms timer hardware.

Typedef Documentation

typedef struct _Task* Task
 

Definition at line 50 of file task.h.

typedef enum _TaskState TaskState
 

typedef enum _TaskType TaskType
 

typedef enum _TaskWaitingOn TaskWaitingOn
 


Enumeration Type Documentation

enum _TaskState
 

Enumerator:
TaskStateDead 
TaskStateAlive 
TaskStateWaiting 
TaskStateTimedOut 

Definition at line 35 of file task.h.

enum _TaskType
 

Enumerator:
TaskTypeOS 
TaskTypeUser 

Definition at line 29 of file task.h.

enum _TaskWaitingOn
 

Enumerator:
TaskWaitingOnMutex 
TaskWaitingOnSemaphore 
TaskWaitingOnDelay 

Definition at line 43 of file task.h.


Function Documentation

ErrorCode taskCreate Task task,
Task  parent,
String  name,
void(*)(void *)  entry,
void *  argument,
TaskType  type,
uint32  stackSize,
uint8  priority
 

Create a new task/process

Parameters:
task The handle for the newly created task
parent The parent for this task. If NULL, a new task will be created. If non-null, a new thread will be created using 'parent's address space.
name The name to assign this thread, up to 64 bytes (63 character NULL terminated string)
entry The entry point of this new process
argument The argument to pass to entry
type The type of process to create
stackSize The size of stack to give this task
priority The priority of this task Should entry return an ErrorCode?

ErrorCode taskDestroy Task task  ) 
 

Delete a task, pre-empting it if currently running

Parameters:
task The handle for the task to delete

ErrorCode taskForceSwitch void   ) 
 

Force a task script operation to occur. This will preempt the current task and call the task scheduler to select a new task.

ErrorCode taskGetCurrent Task task  ) 
 

Returns the task structure of the currently executing task

Parameters:
task The task structure of the currently active task

ErrorCode taskGetMessageQueue Task  task,
MessageQueue queue
 

Get this task's message queue

Parameters:
task The task to query
queue A pointer to where the queue will be returned

ErrorCode taskGetStackBase Task  task,
Pointer ptr
 

Get the base of the stack segment for this task

Parameters:
task The task in question
ptr The base address of the stack

ErrorCode taskGetStackDirection int32 direction  ) 
 

Returns the direction that the stack increments.

Parameters:
direction Will return -1 or +1

ErrorCode taskGetStackPointer Task  task,
Pointer ptr
 

Get the current position on the stack for a specified task.

Parameters:
task The task in question
ptr A copy of the current stack pointer

ErrorCode taskGetStackSize Task  task,
uint32 size
 

Get the size of the task.

Parameters:
task The task in question
size The size of the task's stack

ErrorCode taskGetState Task  task,
TaskState state
 

Return the state of a given task

Parameters:
task The task in question
state The state of that task

ErrorCode taskPrintStackTrace Task  task  ) 
 

Will output (in decently readable terms) the current stack. To be used to exception handlers to print a reset log.

Parameters:
task This task's stack will be printed

ErrorCode taskSetState Task  task,
TaskState  state
 

Update the state of a given task

Parameters:
task The task which will have its state changed
state The state to change it to

ErrorCode taskSetTimeout Task  task,
Timeout  to
 

Delay the currently active task a set number of milliseconds

Parameters:
task The task to set a timeout to
to The timeout to use


Generated on Wed Mar 22 20:36:34 2006 for ndk by  doxygen 1.4.4