[Overview][Constants][Types][Procedures and functions][Variables][Index] 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

Alarm schedules an alarm signal to be delivered to your process in Sec seconds. When Sec seconds have elapsed, Linux will send a SIGALRM signal to the current process. If Sec is 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.
The latest version of this document can be found at lazarus-ccr.sourceforge.net.