The task mechanism allows you to integrate continuous or synchronized code into the primitive activity. For this purpose, the Code Generator provides a special library that extends the C language to support tasking or multi-threading. (Refer to the Scheduler Package for more details).
The scheduler package allows you to define C functions as concurrent routines or co-routines. An activity which you choose to implement as a task is invoked by the control code as a co-routine which is executed concurrently with the rest of the prototype. Since we are dealing with serial machines, concurrency means that the control is switched between these co-routines without interrupting their thread of control. That is, when the co-routine gets the control back, it resumes executing with the exact context it was before. This mechanism allows the activity to use delay statements, wait for events and perform continuous calculations without blocking the rest of the code from continuing execution. When a task is executed, however, the rest of the code is frozen. Thus, synchronization points are introduced. They allow the rescheduling of other tasks (or the control code) to proceed and actions (stop, suspend) to take effect.