TSK_create
Application Program Interface
2-485
number of MADUs to be allocated for the task’s private system stack.
This attribute defaults to the value of the configuration parameter Default
system stack size (preset to 256).
The stackseg attribute specifies the memory segment to use when
allocating the task stack with MEM_alloc; this attribute defaults to the
value of the configuration parameter Default stack segment.
The environ attribute specifies the task’s global environment through a
generic pointer that references an arbitrary application-defined data
structure; this attribute defaults to NULL.
The name attribute specifies the task’s printable name, which is a NULL-
terminated character string; this attribute defaults to the empty string "".
This name can be returned by TSK_getname.
The exitflag attribute specifies whether the task must terminate before
the program as a whole can terminate; this attribute defaults to TRUE.
The initstackflag attribute specifies whether the task stack is initialized to
enable stack depth checking by TSK_checkstacks. This attribute applies
both in cases where the stack attribute is NULL (stack is allocated by
TSK_create) and where the stack attribute is used to specify a pre-
allocated stack. If your application does not call TSK_checkstacks, you
can reduce the time consumed by TSK_create by setting this attribute to
FALSE.
All default attribute values are contained in the constant TSK_ATTRS,
which can be assigned to a variable of type TSK_Attrs prior to calling
TSK_create.
A task switch occurs when calling TSK_create if the priority of the new
task is greater than the priority of the current task.
TSK_create calls MEM_alloc to dynamically create an object’s data
structure. MEM_alloc must lock the memory before proceeding. If
another thread already holds a lock to the memory, then there is a context
switch. The segment from which the object is allocated is described by
the DSP/BIOS objects property in the MEM Module, page 2–205.
Constraints and
Calling Context
❏
TSK_create cannot be called from a SWI or HWI.
❏
The fxn parameter and the name attribute cannot be NULL.
❏
The priority attribute must be less than or equal to TSK_MAXPRI and
greater than or equal to TSK_MINPRI. The priority can be less than
zero (0) for tasks that should not execute.
❏
The string referenced through the name attribute cannot be allocated
locally.