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 3 - Time Manager / Using the Time Manager

Performing Periodic Tasks

One way to install a periodic Time Manager task is to have the task reactivate itself. Because the task record is already inserted into the Time Manager task queue, the task can simply call PrimeTime to reactivate itself. To call PrimeTime, however, the task needs to know the address of the corresponding task record. In the revised and extended Time Managers, the task record's address is placed into register A1 when the task is called. Listing 3-4 illustrates how the task can reactivate itself by retrieving the address in register A1 and passing that address to PrimeTime.

Listing 3-4 Defining a periodic Time Manager task

   INLINE $2E89;                 {MOVE.L A1,(SP)}

PROCEDURE MyTask;                {for revised and extended TMs}
   recPtr:        TMInfoPtr;
   kDelay = 2000;                {delay value}
   recPtr := GetTMInfo;          {first get your own address}

   {Do something here.}

   PrimeTime(QElemPtr(recPtr), kDelay);
You cannot use the technique illustrated in Listing 3-4 with the original Time Manager because it does not pass the address of the task record in register A1. ·

Previous Book Contents Book Index Next

© Apple Computer, Inc.
17 JUN 1996