[Overview][Constants][Types][Procedures and functions] |
Schedule an alarm signal to be delivered
Source position: bunxh.inc line 39
function FpAlarm( |
seconds: cUInt |
):cUInt; |
FpAlarmschedules an alarm signal to be delivered to your process in Secondsseconds. When Secondsseconds have elapsed, the system will send a SIGALRMsignal to the current process. If Secondsis 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.
|
Install signal handler |
|
|
Wait for a signal to arrive |
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.