aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog4
-rw-r--r--src/w32proc.c10
2 files changed, 11 insertions, 3 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index cfa80ed8899..d972f754549 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -7,6 +7,10 @@
7 (getitimer, setitimer): If disable_itimers is non-zero, return an 7 (getitimer, setitimer): If disable_itimers is non-zero, return an
8 error indication without doing anything. Reported by Fabrice 8 error indication without doing anything. Reported by Fabrice
9 Popineau <fabrice.popineau@supelec.fr> as part of bug#12544. 9 Popineau <fabrice.popineau@supelec.fr> as part of bug#12544.
10 (alarm) [HAVE_SETITIMER]: Be more conformant to the expected
11 return results.
12 [!HAVE_SETITIMER]: Behave as the previous version that didn't
13 support timers.
10 14
11 * emacs.c (shut_down_emacs) [WINDOWSNT]: Move the call to 15 * emacs.c (shut_down_emacs) [WINDOWSNT]: Move the call to
12 term_ntproc after all the other bookkeeping, to get timers working 16 term_ntproc after all the other bookkeeping, to get timers working
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 */