[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/trunk r110318: Fix termination sequence on
From: |
Eli Zaretskii |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/trunk r110318: Fix termination sequence on Windows wrt interval timers. |
Date: |
Mon, 01 Oct 2012 11:29:14 +0200 |
User-agent: |
Bazaar (2.5.0) |
------------------------------------------------------------
revno: 110318
fixes bug: http://debbugs.gnu.org/12544
committer: Eli Zaretskii <address@hidden>
branch nick: trunk
timestamp: Mon 2012-10-01 11:29:14 +0200
message:
Fix termination sequence on Windows wrt interval timers.
src/w32proc.c <disable_itimers>: New static flag.
(init_timers): Initialize it to zero, after creating the critical
sections used by the timer threads.
(term_timers): Set to 1 before deleting the critical sections.
(getitimer, setitimer): If disable_itimers is non-zero, return an
error indication without doing anything. Reported by Fabrice
Popineau <address@hidden> as part of bug#12544.
modified:
src/ChangeLog
src/emacs.c
src/w32proc.c
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog 2012-10-01 07:03:04 +0000
+++ b/src/ChangeLog 2012-10-01 09:29:14 +0000
@@ -1,3 +1,17 @@
+2012-10-01 Eli Zaretskii <address@hidden>
+
+ * w32proc.c <disable_itimers>: New static flag.
+ (init_timers): Initialize it to zero, after creating the critical
+ sections used by the timer threads.
+ (term_timers): Set to 1 before deleting the critical sections.
+ (getitimer, setitimer): If disable_itimers is non-zero, return an
+ error indication without doing anything. Reported by Fabrice
+ Popineau <address@hidden> as part of bug#12544.
+
+ * emacs.c (shut_down_emacs) [WINDOWSNT]: Move the call to
+ term_ntproc after all the other bookkeeping, to get timers working
+ as long as possible.
+
2012-10-01 Paul Eggert <address@hidden>
* xdisp.c (syms_of_xdisp): Default message-log-max to 1000, not 100.
=== modified file 'src/emacs.c'
--- a/src/emacs.c 2012-09-26 15:19:10 +0000
+++ b/src/emacs.c 2012-10-01 09:29:14 +0000
@@ -1912,10 +1912,6 @@
unrequest_sigio ();
ignore_sigio ();
-#ifdef WINDOWSNT
- term_ntproc (0);
-#endif
-
/* Do this only if terminating normally, we want glyph matrices
etc. in a core dump. */
if (sig == 0 || sig == SIGTERM)
@@ -1935,6 +1931,10 @@
#ifdef HAVE_LIBXML2
xml_cleanup_parser ();
#endif
+
+#ifdef WINDOWSNT
+ term_ntproc (0);
+#endif
}
=== modified file 'src/w32proc.c'
--- a/src/w32proc.c 2012-09-30 21:36:42 +0000
+++ b/src/w32proc.c 2012-10-01 09:29:14 +0000
@@ -272,6 +272,9 @@
static clock_t ticks_now;
static struct itimer_data real_itimer, prof_itimer;
static clock_t clocks_min;
+/* If non-zero, itimers are disabled. Used during shutdown, when we
+ delete the critical sections used by the timer threads. */
+static int disable_itimers;
static CRITICAL_SECTION crit_real, crit_prof;
@@ -448,6 +451,10 @@
if (prof_itimer.timer_thread)
stop_timer_thread (ITIMER_PROF);
+ /* We are going to delete the critical sections, so timers cannot
+ work after this. */
+ disable_itimers = 1;
+
DeleteCriticalSection (&crit_real);
DeleteCriticalSection (&crit_prof);
DeleteCriticalSection (&crit_sig);
@@ -465,6 +472,8 @@
InitializeCriticalSection (&crit_real);
InitializeCriticalSection (&crit_prof);
InitializeCriticalSection (&crit_sig);
+
+ disable_itimers = 0;
}
static int
@@ -525,6 +534,9 @@
__int64 usecs;
CRITICAL_SECTION *crit;
+ if (disable_itimers)
+ return -1;
+
ticks_now = clock ();
if (!value)
@@ -569,6 +581,9 @@
__int64 usecs;
CRITICAL_SECTION *crit;
+ if (disable_itimers)
+ return -1;
+
/* Posix systems expect timer values smaller than the resolution of
the system clock be rounded up to the clock resolution. First
time we are called, measure the clock tick resolution. */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/trunk r110318: Fix termination sequence on Windows wrt interval timers.,
Eli Zaretskii <=