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 1 - Introduction to Processes and Tasks

About Tasks

An interrupt is a form of exception, an error or special condition detected by the microprocessor in the course of program execution. In particular, an interrupt is an exception that is signaled to the processor by a device. You cannot predict what your application will be doing when an interrupt task is executed. Interrupts can occur not only between different statements that your application executes but also in the middle of a single call that your application makes. For example, your application might invoke a Toolbox trap, and the microprocessor could receive an interrupt in the middle of the execution of the corresponding Toolbox routine.

Interrupts are usually sent by a device to notify the microprocessor of a change in the condition of the device. Routines that are executed as a result of an interrupt are known as interrupt tasks. For example, an interrupt might cause execution of an interrupt task that checks regularly for a change in the position of the mouse and updates the position of the cursor to reflect any change.

Your application can initiate interrupt tasks of its own. For example, you could write an interrupt task that repeatedly spins the cursor or increments a global variable. However, even application-generated interrupt tasks do not occur at predictable points in your application's execution. Applications can schedule tasks to be performed at regular time intervals, such as 100 times per second, or in response to conditions in hardware devices. Tasks scheduled at regular time intervals are actually executed in response to hardware devices that perceive that requested time intervals have elapsed. The actual execution of tasks is independent of the flow of application code.

Task Creation
Task Scheduling
Task Guidelines

Previous Book Contents Book Index Next

© Apple Computer, Inc.
17 JUN 1996