Page 121 of 346 Start Back Next End ZBasic System Library 109 ZBasic Microcontrollers ExitTask Type Subroutine Invocation ExitTask(taskStack) ExitTask() Parameter Method Type Description taskStack ByRef array of Byte The stack for a task of interest. Discussion This routine attempts to terminate an active task. If no task stack is explicitly given, the task stack for the Main() routine is assumed. If this routine is invoked using an array other than one that is or was being used for a task stack the result is undefined. See the section on Task Management in the ZBasic Reference Manual for additional information regarding task management. When a task exits, whether normally or via ExitTask(), that task’s status is first set to 254 indicating that it is in the process of exiting but that it is still in the task list. The exiting task will remain in the task list until the task manager runs again. The task manager runs whenever a task switch is called for but you can force it to run by invoking Sleep() or Yield(). Once the task manager removes an exiting task from the task list, its status will change to 255 indicating that it is fully terminated. Compatibility This routine is not available in BasicX compatibility mode. See Also ResumeTask, RunTask, StatusTask