[Overview][Constants][Types][Procedures and functions][Variables] Reference for unit 'oldlinux' (#rtl)

Alarm

Schedule an alarm signal to be delivered

Declaration

Source position: oldlinux.pp line 1487

function Alarm(

  Sec: LongInt

):LongInt;

Description

Alarmschedules an alarm signal to be delivered to your process in Secseconds. When Secseconds have elapsed, Linux will send a SIGALRMsignal to the current process. If Secis zero, then no new alarm will be set. Whatever the value of Sec, any previous alarm is cancelled.

The function returns the number of seconds till the previously scheduled alarm was due to be delivered, or zero if there was none.

See also

SigAction

  

Install signal handler

Example

Program Example59;

{ Program to demonstrate the Alarm function. }

Uses oldlinux;

Procedure AlarmHandler(Sig : longint);cdecl;

begin
  Writeln ('Got to alarm handler');
end;

begin
  Writeln('Setting alarm handler');
  Signal(SIGALRM,@AlarmHandler);
  Writeln ('Scheduling Alarm in 10 seconds');
  Alarm(10);
  Writeln ('Pausing');
  Pause;
  Writeln ('Pause returned');
end.