mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-21 13:29:28 +02:00
28 lines
556 B
ObjectPascal
28 lines
556 B
ObjectPascal
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.
|