home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power-Programmierung
/
CD1.mdf
/
lan
/
spy
/
source
/
multitsr.pas
< prev
next >
Wrap
Pascal/Delphi Source File
|
1989-10-03
|
1KB
|
56 lines
{$A+,B-,D-,E-,F+,I-,L-,N-,O-,R-,S-,V+}
Unit MultiTsr;
{ This unit links the TSR and MULTI units.
Copyright 1989 by Edwin T. Floyd
All rights reserved.
Non-commercial use Ok.
Use at your own risk.
Author: Edwin T. Floyd [76067,747]
#9 Adams Park Court
Columbus, GA 31909
(404) 322-0076
}
Interface Uses TSR, MULTI;
Const
MaxTicksToWait = 1200; { Maximum number of ticks to wait in IdleRoutine }
Implementation
Var
OldDispatchHook : HookRoutineType;
SmallWaitCount : Byte;
Procedure TsrIdle(Timeout : LongInt);
Begin
If Timeout < 7 Then Begin
If Timeout < SmallWaitCount Then Dec(SmallWaitCount, Timeout)
Else Begin
SmallWaitCount := 6;
TsrWait(1);
End;
End Else Begin
Timeout := Timeout Div 6;
If Timeout > MaxTicksToWait Then Timeout := MaxTicksToWait;
TsrWait(Timeout);
End;
End;
Procedure WakeHook(Task : TaskType; Entry : DispatchHookType);
Begin
If Entry = HookWake Then WakeBackground;
OldDispatchHook(Task, Entry);
End;
Procedure MultiTsrExit;
Begin
RemoveTSR;
End;
Begin
SmallWaitCount := 6;
IdleRoutine := TsrIdle;
OldDispatchHook := DispatchHook;
DispatchHook := WakeHook;
ExitProc := @MultiTsrExit;
End.