From: Raul Newsgroups: comp.os.msdos.djgpp Subject: How does signals work on djgpp? Date: Fri, 27 Mar 1998 12:25:22 +0100 Organization: Universitat Autonoma de Barcelona Lines: 59 Distribution: inet Message-ID: Reply-To: Raul NNTP-Posting-Host: xi.uab.es Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk 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? What does pause() do on djgpp? How can I wait for a signal? 10x. Here is the code: #include #include #include #include static jmp_buf entorno; static void sigalrm_handler (sig) int sig; { longjmp (entorno, 1); } void lock_my_handler (){ _go32_dpmi_lock_code(sigalrm_handler, (unsigned long)(lock_my_handler - sigalrm_handler)); } dormir(seg) unsigned seg; { unsigned alarma_ant; void (*sigalrm_handler_ant) (); if (seg==0) return; sigalrm_handler_ant=signal(SIGALRM, sigalrm_handler); if (setjmp(entorno)==0){ alarma_ant = alarm (seg); pause (); } else { signal(SIGALRM, sigalrm_handler_ant); alarm(alarma_ant); } } main (){ int i; lock_my_handler (); for (i=0;i<10;i++){ printf ("sleeping %d seconds.\n", i ); dormir (i); } }