From 941811ccb9faf01463c3f6c5637969cbe17cb64c Mon Sep 17 00:00:00 2001 From: Andy Polyakov Date: Thu, 15 Dec 2011 22:30:11 +0000 Subject: [PATCH] apps/speed.c: Cygwin alarm() fails sometimes. PR: 2655 --- apps/speed.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/apps/speed.c b/apps/speed.c index 1eed48c11c..ffc50265ee 100644 --- a/apps/speed.c +++ b/apps/speed.c @@ -108,8 +108,14 @@ #include #endif -#ifdef _WIN32 +#if defined(_WIN32) || defined(__CYGWIN__) #include +# if defined(__CYGwIN__) && !defined(_WIN32) + /* should define _WIN32, which normally is mutually + * exclusive with __CYGWIN__, but if it didn't... */ +# define _WIN32 + /* this is done because Cygwin alarm() fails sometimes. */ +# endif #endif #include @@ -292,9 +298,12 @@ static SIGRETTYPE sig_done(int sig) #if defined(_WIN32) +#if !defined(SIGALRM) #define SIGALRM +#endif static unsigned int lapse,schlock; -static void alarm(unsigned int secs) { lapse = secs*1000; } +static void alarm_win32(unsigned int secs) { lapse = secs*1000; } +#define alarm alarm_win32 static DWORD WINAPI sleepy(VOID *arg) { -- 2.25.1