www.delorie.com/archives/browse.cgi | search |
Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
List-Archive: | <http://sourceware.org/ml/cygwin/> |
List-Post: | <mailto:cygwin AT cygwin DOT com> |
List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs> |
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" <maxb AT ukf DOT net> |
To: | <cygwin AT cygwin DOT com> |
Subject: | Problem with alarm() not functioning twice in one program. |
Date: | Tue, 8 Feb 2005 20:29:33 -0000 |
MIME-Version: | 1.0 |
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 <stdio.h> #include <signal.h> #include <setjmp.h> #include <unistd.h> 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/
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |