In this example, the TFH is designed to send a message to another thread and prepare the thread to restart execution if a missed deadline occurs, and gracefully shuts down the system if the thread uses more than its allotted WCET.
The program counter is then modified to contain the start address of the generic TFH re-entrant code.
After executing a TFH, there are three possibilities to resume processing: restart, continue, or exit.
In such cases, execution of the TFH must be delayed until the end of the critical section to ensure the integrity of the data.
If a thread is on the BLOCKED queue, it is moved to the READY queue, with the next instruction to execute being the TFH. In this case, if the continue option for the thread is selected, the thread returns to the BLOCKED queue.
The latency to call a TFH is the length of one context switch, plus 12 [micro]sec (on a 25MHz MC68030) for updating the stored context and executing the generic assembly language framework.
The routine dshandler() is the TFH that is called when either the server's capacity has expired or the server's replenishment time has arrived.
As a result of using up its time, the microkernel signals a timing error, and the TFH for the DS is called.
When the thread's deadline time arrives, the microkernel detects this as a timing error, and again calls the TFH. This time, however, the error is of type DEADLINE, which implies a missed deadline.
This means that the TFH will only be called when the maximum execution time reaches zero, and not as a result of any kind of missed deadline.