Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2001-02

SIGALRM?

2 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Alejandro Néstor Vargas

For the Linux gurus:

I'm writing a program in fpc that does direct access to the tty using raw mode. I can't use the CRT unit because it initializes the screen and sends some escape sequences at the beginning of the program. Then I copied some parts of CRT unit like delay and setmode. I also created a function for checking if there are characters waiting to be readed from standard input.

function InputPending: boolean;
var
  fdsin : fdSet;
begin
FD_Zero(fdsin);
fd_Set(0,fdsin);
InputPending:=(Select(1,@fdsin,nil,nil,nil)>0);
end;
Procedure Delay(DTime: Word);
Begin
    Select(0,nil,nil,nil,DTime);
End;

The program works right, but there is a problem. Randomly, some time after the program is running, it receives a SIGALRM from the system and it ends. I solved it by trapping this signal, but... anybody knows why it signal is generated?

Alejandro Néstor Vargas

Reply by email

Marco van de Voort
to Alejandro Néstor Vargas
Show quoted text 14 lines
fd_Set(0,fdsin); InputPending:=(Select(1,@fdsin,nil,nil,nil)>0); end; Procedure Delay(DTime: Word); Begin Select(0,nil,nil,nil,DTime); End; The program works right, but there is a problem. Randomly, some time after the program is running, it receives a SIGALRM from the system and it ends. I solved it by trapping this signal, but... anybody knows why it signal is generated?

I'm no guru, but do you sometimes don't call inputpending for a while, or read from stdin?

Then maybe some internal buffer could overflow if people are still typing?

Reply by email