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

FpSignal

Install signal handler (deprecated)

Declaration

Source position: bunxovlh.inc line 51

function FpSignal(

  signum: LongInt;

  Handler: signalhandler

):signalhandler;

Description

FPSignal installs a new signal handler (specified by Handler) for signal SigNum.

This call has a subset of the functionality provided by the FpSigAction call. The return value for FpSignal is the old signal handler, or nil on error.

Errors

Extended error information can be retrieved using fpGetErrno.

SIG_ERR
An error occurred.

See also

FpSigAction

  

Install signal handler

FpKill

  

Send a signal to a process

Example

Program example58;

{ Program to demonstrate the Signal function.}

{
do a kill -USR1 pid from another terminal to see what happens.
replace pid with the real pid of this program.
You can get this pid by running 'ps'.
}

uses BaseUnix;

Procedure DoSig(sig : cint);cdecl;

begin
   writeln('Receiving signal: ',sig);
end;

begin
   if fpSignal(SigUsr1,SignalHandler(@DoSig))=signalhandler(SIG_ERR) then
     begin
     writeln('Error: ',fpGetErrno,'.');
     halt(1);
     end;
   Writeln ('Send USR1 signal or press <ENTER> to exit');
   readln;
end.

Documentation generated on: Mar 17 2017