Page 104 of 229 Start Back Next End ZBasic Language Reference 94 ZBasic Microcontrollers 3.30 Task Management The ZBasic System Library has several routines that are helpful for managing tasks including LockTask(), UnlockTask(), StatusTask(), ResumeTask(), RunTask() and ExitTask(). The latter four routines permit some advanced task management for special situations. One use of these routines is to implement a timeout on a task that is awaiting the completion of an event, e.g. an external interrupt or an input capture. Normally, when a task is set to wait for an event like these it will wait indefinitely. 3.30.1 Task Control Block Each task has an associated Task Control Block (TCB) - a data area that occupies the first few bytes of the task stack in VM mode (the last few bytes of the task stack in native mode). In most cases, a program will not need to access the contents of a TCB. The information is included here for those rare circumstances when is needed. Use of this information is recommended for advanced programmers only. When a task is activated its task control block is initialized and then inserted into a circular linked list immediately following the task control block of the then-current task. The table below gives some information on the structure of the task control block. It is important to note that this information is considered implementation detail subject to change as necessary.