[fpc-devel] sleep and SIGINT on 2.4.0

beld beld at netzonesoft.com
Thu Nov 26 06:38:06 CET 2009


hi, freepascal developers

I found a question about 2.4.0 yesterday and do some check today.

in Kylix 3: the Ctrl+C whill break the "sleep" call, and fpc 2.2.4 do same.

but in 2.4.0, Ctrl+C is handled, but "sleep" is sleeping yet.


//--------- testing code begin ---------------------------------------------
uses
  {$ifdef fpc}
  baseunix, 
  {$else}
  Libc,
  {$endif}
  SysUtils;
  
procedure sig_int(sig: Longint); cdecl;
begin
  writeln(' -> [Ctrl+C]: ', FormatDateTime('hh:nn:ss.zzz', Now));
end;

begin
  {$ifdef fpc}
  fpsignal(SIGINT, signalhandler(@sig_int));
  {$else}
  signal(SIGINT, @sig_int);
  {$endif}
  writeln(FormatDateTime('hh:nn:ss.zzz', Now));
  sleep(10 * 1000);
  writeln(FormatDateTime('hh:nn:ss.zzz', Now));
end.

//--------- testing code end ---------------------------------------------	

 				

beld
beld at netzonesoft.com
2009-11-26





More information about the fpc-devel mailing list