mirror of
				https://gitlab.com/freepascal.org/fpc/source.git
				synced 2025-10-31 16:31:36 +01:00 
			
		
		
		
	
		
			
				
	
	
		
			29 lines
		
	
	
		
			534 B
		
	
	
	
		
			ObjectPascal
		
	
	
	
	
	
			
		
		
	
	
			29 lines
		
	
	
		
			534 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 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.
 | 
