Important: The information in this document is obsolete and should not be used for new development.
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 callPrimeTime
to reactivate itself. To callPrimeTime
, 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 toPrimeTime
.Listing 3-4 Defining a periodic Time Manager task
FUNCTION GetTMInfo: TMInfoPtr; INLINE $2E89; {MOVE.L A1,(SP)} PROCEDURE MyTask; {for revised and extended TMs} VAR recPtr: TMInfoPtr; CONST kDelay = 2000; {delay value} BEGIN recPtr := GetTMInfo; {first get your own address} {Do something here.} PrimeTime(QElemPtr(recPtr), kDelay); END;
- IMPORTANT
- 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. ·