aboutsummaryrefslogtreecommitdiffstats
path: root/src/w32proc.c
diff options
context:
space:
mode:
authorEli Zaretskii2012-10-01 11:46:01 +0200
committerEli Zaretskii2012-10-01 11:46:01 +0200
commit4cdfbb8976eaff3cd5c36b9e2b3489483482e305 (patch)
tree1e8489caa68bf8444d9f899e9aa47e7e3f480dce /src/w32proc.c
parentf0e5f2255f62cf59eaf84e642ada10f64b1fc9d1 (diff)
downloademacs-4cdfbb8976eaff3cd5c36b9e2b3489483482e305.tar.gz
emacs-4cdfbb8976eaff3cd5c36b9e2b3489483482e305.zip
Improve 'alarm' implementation on MS-Windows.
src/w32proc.c (alarm) [HAVE_SETITIMER]: Be more conformant to the expected return results. [!HAVE_SETITIMER]: Behave as the previous version that didn't support timers.
Diffstat (limited to 'src/w32proc.c')
-rw-r--r--src/w32proc.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/w32proc.c b/src/w32proc.c
index 159d6e00957..b0881c25d6c 100644
--- a/src/w32proc.c
+++ b/src/w32proc.c
@@ -669,15 +669,19 @@ setitimer(int which, struct itimerval *value, struct itimerval *ovalue)
669int 669int
670alarm (int seconds) 670alarm (int seconds)
671{ 671{
672 struct itimerval new_values; 672#ifdef HAVE_SETITIMER
673 struct itimerval new_values, old_values;
673 674
674 new_values.it_value.tv_sec = seconds; 675 new_values.it_value.tv_sec = seconds;
675 new_values.it_value.tv_usec = 0; 676 new_values.it_value.tv_usec = 0;
676 new_values.it_interval.tv_sec = new_values.it_interval.tv_usec = 0; 677 new_values.it_interval.tv_sec = new_values.it_interval.tv_usec = 0;
677 678
678 setitimer (ITIMER_REAL, &new_values, NULL); 679 if (setitimer (ITIMER_REAL, &new_values, &old_values) < 0)
679 680 return 0;
681 return old_values.it_value.tv_sec;
682#else
680 return seconds; 683 return seconds;
684#endif
681} 685}
682 686
683/* Defined in <process.h> which conflicts with the local copy */ 687/* Defined in <process.h> which conflicts with the local copy */