delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/03/29/12:51:57

Date: Sun, 29 Mar 1998 14:27:14 +0300 (IDT)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: Raul <e36531491 AT omega DOT uab DOT es>
cc: djgpp AT delorie DOT com
Subject: Re: How does signals work on djgpp?
In-Reply-To: <Pine.SOL.3.95.980327121832.3637A-100000@Xi>
Message-ID: <Pine.SUN.3.91.980329142653.15237R-100000@is>
MIME-Version: 1.0

On Fri, 27 Mar 1998, Raul wrote:

> I have made a example program for testing signals. I call alarm() and a
> SIGALRM signal is suposed to be generated, but no signal y raised at all.
> Why?

You don't give SIGALRM any chance to be raised, since you are calling
it to set a new alarm too quickly.  Since every call to `alarm'
superceeds the previous alarm setting, SIGALRM is never raised.  If
you want to see the alarm go off, you need to let at least N seconds
pass, where N is the argument in the last call to `alarm'.

> What does pause() do on djgpp?

Nothing like you expect.  It certainly doesn't pause the program
indefinitely.  Please consult the library reference for that function
(from the DOS prompt type "info libc alpha pause").

> How can I wait for a signal?

Use `sleep', or `usleep'.  Or just let your program do something for
more than the time you set the alarm to.

Also, please read the fine print in the documentation of the `signal'
function ("info libc alpha signal"), as the DJGPP implementation of
signals has some noteworthy subtleties.

> void lock_my_handler (){
>   _go32_dpmi_lock_code(sigalrm_handler, (unsigned long)(lock_my_handler - sigalrm_handler));
> }

You don't need to lock SIGALRM handlers.

- Raw text -


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