delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/08/28/19:15:11

From: "Raf256" <rmaj AT mail DOT pgd DOT pl>
Newsgroups: comp.os.msdos.djgpp
Subject: Timer interrupt ?
Date: Wed, 29 Aug 2001 00:38:30 +0200
Organization: tp.internet - http://www.tpi.pl
Lines: 30
Message-ID: <9mh6j2$jql$1@news.tpi.pl>
NNTP-Posting-Host: mail.pgd.pl
X-Trace: news.tpi.pl 999038370 20309 195.116.155.208 (28 Aug 2001 22:39:30 GMT)
X-Complaints-To: usenet AT tpi DOT pl
NNTP-Posting-Date: 28 Aug 2001 22:39:30 GMT
X-Newsreader: Microsoft Outlook Express 5.00.2615.200
X-MSMail-Priority: Normal
X-Priority: 3
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2615.200
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Hi,
I read the FAQ, but I didn't find all answares...
I have following problem - I'm using alarm() and to detect infinite (or to
long) loops, handler of sigalrm makes long jump to special funcion that
informs tahat program probably had hanged.
Q#1 can I make long jump to instruction that was going to execute when
signal was rised ? I can use it to display something like : Program hanged,
[K]ill, [I]gnore  :-)

Q#2 but alarm wan't work in f(;;), AFAIR because this loop doesn't touch any
data... I think taht timer interrupt 1C might help... can somone PLEASE
write litle example (it's 10-15 lines probably)...
Something like :

jmp_buf jjj;  void handler() { longjmp(jjj,1); }
main() {  /* install handler ????? */   alarm(5);
  if (setjmp(handler,1)) return 1;
  f(;;)
}

Q#3 How should I lock memory in this example ? I heard that all data touched
in signal handler should be atomic_t but I need jum_buf...

Q#4 In FAQ it is written that it's impossible to determinate size of C/C++
function ? But Allegro is doing this simply by putting empty function right
after original function and checking it's adress...

Thanx :)


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019