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

FpAlarm

Schedule an alarm signal to be delivered

Declaration

Source position: bunxh.inc line 42

function FpAlarm(

  seconds: cuint

):cuint;

Description

FpAlarm schedules an alarm signal to be delivered to your process in Seconds seconds. When Seconds seconds have elapsed, the system will send a SIGALRM signal to the current process. If Seconds is zero, then no new alarm will be set. Whatever the value of Seconds, 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. A negative value indicates an error.

See also

fpSigAction

  

Install signal handler

fpPause

  

Wait for a signal to arrive

Example

Program Example59;

{ Program to demonstrate the Alarm function. }

Uses BaseUnix;

Procedure AlarmHandler(Sig : cint);cdecl;

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

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

Documentation generated on: Mar 17 2017