Supplementing Generated C : Scheduler Package : Creating a Task

Creating a Task

In order to create a new task, call

task_entry *sched_create_task(proc, param, stoproc, stoparam, model_context, inst_context)
void_funcp proc; /* proc(param) is activated as task*/
 
unsigned long param;
void_funcp stoproc; /* stoproc(&stoparam) is called
when the task terminates*/
 
char *stoparam;
 
void *model_context;
/* when several separately generated models are integrated with user-written main(), this parameter identifies the model to which the task belongs*/
 
void *inst_context;
/* when task is connected to activity in a generic activity-chart, this parameter identifies the currently executed instance*/
 
 

This routine initializes a task and returns to its caller a descriptor, which is to be used in further references to this task.

The task is initialized with a 40 KB stack. In case of stack overflow, a message is printed and the task is aborted.