
Task Support
2-8
Get the Handle to the Currently Executing Task Thread
TaskSelf
Syntax
HANDLE TaskSelf();
Parameter(s)
none
Return Value
Handle to currently executing thread, or NULL on error
Description
Returns the task handle of the currently executing task thread. This function
is used mainly in other task object calls where the caller wishes to operate on
the current thread, but does not know the current thread’s handle.
If called on an illegal (system) thread, this function returns NULL. Only certain
implementations of the OS even have a system thread, and then, no user code
should ever be executed on it. A NULL may also result if Task functions are
called before the operating system is initialized.
Set Task Environment Handle
TaskSetEnv
Syntax
void TaskSetEnv( HANDLE hTask, int Slot, HANDLE hEnv );
Parameter(s)
hTask
Handle to target task
Slot
Environment slot to use (1–3)
hEnv
Private environment handle
Return Value
nothing
Description
NOTE: This function is currently not available under DSP/BIOS
Sets and stores a private environment handle for the supplied task handle
hTask. This handle can be later retrieved by TaskGetEnv(). The slot specified
in Slot assigns an address (1–3) to the environment handle. There are actually
four slots, but slot 0 is reserved.
Environment handles can be used to associate private data with a task thread.
This is useful when multiple threads share the same code base, but require
their own instance of static data.