~ubuntu-branches/ubuntu/feisty/fpc/feisty

« back to all changes in this revision

Viewing changes to fpcdocs/unixex/ex65.pp

  • Committer: Bazaar Package Importer
  • Author(s): Torsten Werner
  • Date: 2007-01-27 20:08:50 UTC
  • mfrom: (1.2.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20070127200850-9mrptaqqjsx9nwa7
Tags: 2.0.4-5
* Fixed Build-Depends.
* Add myself to Uploaders in debian/control.
* Make sure that the sources are really patched before building them.
* Build unit 'libc' on powerpc too.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
Program example64;
 
2
 
 
3
{ Program to demonstrate the SigRaise function.}
 
4
 
 
5
uses Unix,BaseUnix;
 
6
 
 
7
Var
 
8
   oa,na : PSigActionRec;
 
9
 
 
10
Procedure DoSig(sig : Longint);cdecl;
 
11
 
 
12
begin
 
13
   writeln('Receiving signal: ',sig);
 
14
end;
 
15
 
 
16
begin
 
17
   new(na);
 
18
   new(oa);
 
19
   na^.sa_handler:=TSigaction(@DoSig);
 
20
   fillchar(na^.Sa_Mask,sizeof(na^.Sa_Mask),#0);
 
21
   na^.Sa_Flags:=0;
 
22
   {$ifdef Linux}
 
23
   // this member is linux only, and afaik even there arcane
 
24
   na^.Sa_Restorer:=Nil;
 
25
   {$endif}
 
26
   if fpSigAction(SigUsr1,na,oa)<>0 then
 
27
     begin
 
28
     writeln('Error: ',fpgeterrno);
 
29
     halt(1);
 
30
     end;
 
31
   Writeln('Sending USR1 (',sigusr1,') signal to self.');
 
32
   SigRaise(sigusr1);
 
33
end.
 
 
b'\\ No newline at end of file'