Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: Processes
Chapter 4 - Vertical Retrace Manager / About the Vertical Retrace Manager

Types of VBL Tasks

There are two general types of VBL tasks. A slot-based VBL task is linked to an external video monitor. Because different monitors can have different refresh rates and hence might execute VBL tasks at different times, the Vertical Retrace Manager maintains a separate task queue for each video device attached to the computer. When a VBL interrupt occurs for a particular device, the Vertical Retrace Manager executes any tasks in the queue for the slot holding that monitor's video card. You can install a slot-based VBL task by calling the SlotVInstall function.

For Macintosh computers that have only a built-in monitor (such as a Macintosh Plus or Macintosh Classic), there is no need to isolate VBL tasks into separate queues. Instead, the Operating System maintains just one task queue and processes the tasks in that queue when it receives a VBL interrupt. A VBL task that is not linked to an external video device is known as a system-based VBL task. You can install a system-based VBL task by calling the VInstall function.

To maintain compatibility on modular Macintosh computers for software that uses the VInstall function, the Operating System generates a special interrupt at a frequency identical to the retrace rate on compact Macintosh computers. This special interrupt is generated approximately 60.15 times a second and mimics the vertical retrace interrupt on compact models. This ensures that application tasks installed using the VInstall function, as well as periodic system tasks such as updating the tick count and checking whether the stack has expanded into the heap, are performed as usual.

To ensure the synchronization of your VBL task with the retracing of the screen, you should check whether the SlotVInstall function is available in the current operating environment. If it is, you should use the slot-based routines to install and remove your VBL task. If not, you should use the system-based routines.

However, even if you synchronize your VBL task to the retracing of the screen correctly, tasks may not always execute as scheduled. Some types of system activity, such as disk access, may cause VBL interrupts to be disabled temporarily. (This is why cursor movement sometimes becomes jerky during disk operations.) Also, if a VBL task takes longer to perform than the time it takes to retrace the screen, other interrupt tasks may miss one or more vertical retrace interrupts.

Like all interrupt tasks, VBL tasks cannot do everything that ordinary routines can. The following list summarizes the operations that VBL tasks should not perform. A VBL task that violates one of these rules may cause a system crash:

Previous Book Contents Book Index Next

© Apple Computer, Inc.
17 JUN 1996