Date: Sun, 29 Mar 1998 14:27:14 +0300 (IDT) From: Eli Zaretskii To: Raul cc: djgpp AT delorie DOT com Subject: Re: How does signals work on djgpp? In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Precedence: bulk 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.