[Overview][Constants][Types][Procedures and functions][Index] |
Schedule an alarm signal to be delivered
Source position: bunxh.inc line 39
function FpAlarm( |
seconds: cuint |
):cuint; |
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.
|
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.
lazarus-ccr.sourceforge.net |