ex58.pp 534 B

12345678910111213141516171819202122232425262728
  1. Program example58;
  2. { Program to demonstrate the Signal function.}
  3. {
  4. do a kill -USR1 pid from another terminal to see what happens.
  5. replace pid with the real pid of this program.
  6. You can get this pid by running 'ps'.
  7. }
  8. uses Linux;
  9. Procedure DoSig(sig : Longint);cdecl;
  10. begin
  11. writeln('Receiving signal: ',sig);
  12. end;
  13. begin
  14. SigNal(SigUsr1,@DoSig);
  15. if LinuxError<>0 then
  16. begin
  17. writeln('Error: ',linuxerror,'.');
  18. halt(1);
  19. end;
  20. Writeln ('Send USR1 signal or press <ENTER> to exit');
  21. readln;
  22. end.