浏览代码

Forgot to add

michael 27 年之前
父节点
当前提交
338a563380
共有 1 个文件被更改,包括 28 次插入0 次删除
  1. 28 0
      docs/linuxex/ex58.pp

+ 28 - 0
docs/linuxex/ex58.pp

@@ -0,0 +1,28 @@
+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 Linux;
+
+Procedure DoSig(sig : Longint);cdecl;
+
+begin
+   writeln('Receiving signal: ',sig);
+end; 
+
+begin
+   SigNal(SigUsr1,@DoSig);
+   if LinuxError<>0 then
+     begin
+     writeln('Error: ',linuxerror,'.');
+     halt(1);
+     end;
+   Writeln ('Send USR1 signal or press <ENTER> to exit'); 
+   readln;
+end.