Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Message-ID: <030901c50e1d$51a22b30$e6ec6f83@robinson.cam.ac.uk> From: "Max Bowsher" To: Subject: Problem with alarm() not functioning twice in one program. Date: Tue, 8 Feb 2005 20:29:33 -0000 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=original Content-Transfer-Encoding: 7bit X-Cam-ScannerInfo: http://www.cam.ac.uk/cs/email/scanner/ X-Cam-AntiVirus: No virus found X-Cam-SpamDetails: Not scanned X-IsSubscribed: yes Note-from-DJ: This may be spam The following program produces the output: Begin Done Begin ...and then hangs. Can anyone help me understand why? Thankyou, Max. #include #include #include #include jmp_buf timer; void alarm_handler(int dummy) { longjmp(timer, 1); } void speedtest(void) { fprintf(stderr, "Begin\n"); signal(SIGALRM, alarm_handler); if (setjmp(timer) == 0) { alarm(1); while(1) {}; } signal(SIGALRM, SIG_DFL); fprintf(stderr, "Done\n"); return; } int main(int argc, char* argv[]) { speedtest(); speedtest(); return 0; } -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/