diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 14 | ||||
| -rw-r--r-- | src/emacs.c | 8 | ||||
| -rw-r--r-- | src/w32proc.c | 15 |
3 files changed, 33 insertions, 4 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 41b2d24b968..cfa80ed8899 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,17 @@ | |||
| 1 | 2012-10-01 Eli Zaretskii <eliz@gnu.org> | ||
| 2 | |||
| 3 | * w32proc.c <disable_itimers>: New static flag. | ||
| 4 | (init_timers): Initialize it to zero, after creating the critical | ||
| 5 | sections used by the timer threads. | ||
| 6 | (term_timers): Set to 1 before deleting the critical sections. | ||
| 7 | (getitimer, setitimer): If disable_itimers is non-zero, return an | ||
| 8 | error indication without doing anything. Reported by Fabrice | ||
| 9 | Popineau <fabrice.popineau@supelec.fr> as part of bug#12544. | ||
| 10 | |||
| 11 | * emacs.c (shut_down_emacs) [WINDOWSNT]: Move the call to | ||
| 12 | term_ntproc after all the other bookkeeping, to get timers working | ||
| 13 | as long as possible. | ||
| 14 | |||
| 1 | 2012-10-01 Paul Eggert <eggert@cs.ucla.edu> | 15 | 2012-10-01 Paul Eggert <eggert@cs.ucla.edu> |
| 2 | 16 | ||
| 3 | * xdisp.c (syms_of_xdisp): Default message-log-max to 1000, not 100. | 17 | * xdisp.c (syms_of_xdisp): Default message-log-max to 1000, not 100. |
diff --git a/src/emacs.c b/src/emacs.c index 05affeefde7..f3f2081e2e9 100644 --- a/src/emacs.c +++ b/src/emacs.c | |||
| @@ -1912,10 +1912,6 @@ shut_down_emacs (int sig, Lisp_Object stuff) | |||
| 1912 | unrequest_sigio (); | 1912 | unrequest_sigio (); |
| 1913 | ignore_sigio (); | 1913 | ignore_sigio (); |
| 1914 | 1914 | ||
| 1915 | #ifdef WINDOWSNT | ||
| 1916 | term_ntproc (0); | ||
| 1917 | #endif | ||
| 1918 | |||
| 1919 | /* Do this only if terminating normally, we want glyph matrices | 1915 | /* Do this only if terminating normally, we want glyph matrices |
| 1920 | etc. in a core dump. */ | 1916 | etc. in a core dump. */ |
| 1921 | if (sig == 0 || sig == SIGTERM) | 1917 | if (sig == 0 || sig == SIGTERM) |
| @@ -1935,6 +1931,10 @@ shut_down_emacs (int sig, Lisp_Object stuff) | |||
| 1935 | #ifdef HAVE_LIBXML2 | 1931 | #ifdef HAVE_LIBXML2 |
| 1936 | xml_cleanup_parser (); | 1932 | xml_cleanup_parser (); |
| 1937 | #endif | 1933 | #endif |
| 1934 | |||
| 1935 | #ifdef WINDOWSNT | ||
| 1936 | term_ntproc (0); | ||
| 1937 | #endif | ||
| 1938 | } | 1938 | } |
| 1939 | 1939 | ||
| 1940 | 1940 | ||
diff --git a/src/w32proc.c b/src/w32proc.c index fb872990bd0..159d6e00957 100644 --- a/src/w32proc.c +++ b/src/w32proc.c | |||
| @@ -272,6 +272,9 @@ struct itimer_data { | |||
| 272 | static clock_t ticks_now; | 272 | static clock_t ticks_now; |
| 273 | static struct itimer_data real_itimer, prof_itimer; | 273 | static struct itimer_data real_itimer, prof_itimer; |
| 274 | static clock_t clocks_min; | 274 | static clock_t clocks_min; |
| 275 | /* If non-zero, itimers are disabled. Used during shutdown, when we | ||
| 276 | delete the critical sections used by the timer threads. */ | ||
| 277 | static int disable_itimers; | ||
| 275 | 278 | ||
| 276 | static CRITICAL_SECTION crit_real, crit_prof; | 279 | static CRITICAL_SECTION crit_real, crit_prof; |
| 277 | 280 | ||
| @@ -448,6 +451,10 @@ term_timers (void) | |||
| 448 | if (prof_itimer.timer_thread) | 451 | if (prof_itimer.timer_thread) |
| 449 | stop_timer_thread (ITIMER_PROF); | 452 | stop_timer_thread (ITIMER_PROF); |
| 450 | 453 | ||
| 454 | /* We are going to delete the critical sections, so timers cannot | ||
| 455 | work after this. */ | ||
| 456 | disable_itimers = 1; | ||
| 457 | |||
| 451 | DeleteCriticalSection (&crit_real); | 458 | DeleteCriticalSection (&crit_real); |
| 452 | DeleteCriticalSection (&crit_prof); | 459 | DeleteCriticalSection (&crit_prof); |
| 453 | DeleteCriticalSection (&crit_sig); | 460 | DeleteCriticalSection (&crit_sig); |
| @@ -465,6 +472,8 @@ init_timers (void) | |||
| 465 | InitializeCriticalSection (&crit_real); | 472 | InitializeCriticalSection (&crit_real); |
| 466 | InitializeCriticalSection (&crit_prof); | 473 | InitializeCriticalSection (&crit_prof); |
| 467 | InitializeCriticalSection (&crit_sig); | 474 | InitializeCriticalSection (&crit_sig); |
| 475 | |||
| 476 | disable_itimers = 0; | ||
| 468 | } | 477 | } |
| 469 | 478 | ||
| 470 | static int | 479 | static int |
| @@ -525,6 +534,9 @@ getitimer (int which, struct itimerval *value) | |||
| 525 | __int64 usecs; | 534 | __int64 usecs; |
| 526 | CRITICAL_SECTION *crit; | 535 | CRITICAL_SECTION *crit; |
| 527 | 536 | ||
| 537 | if (disable_itimers) | ||
| 538 | return -1; | ||
| 539 | |||
| 528 | ticks_now = clock (); | 540 | ticks_now = clock (); |
| 529 | 541 | ||
| 530 | if (!value) | 542 | if (!value) |
| @@ -569,6 +581,9 @@ setitimer(int which, struct itimerval *value, struct itimerval *ovalue) | |||
| 569 | __int64 usecs; | 581 | __int64 usecs; |
| 570 | CRITICAL_SECTION *crit; | 582 | CRITICAL_SECTION *crit; |
| 571 | 583 | ||
| 584 | if (disable_itimers) | ||
| 585 | return -1; | ||
| 586 | |||
| 572 | /* Posix systems expect timer values smaller than the resolution of | 587 | /* Posix systems expect timer values smaller than the resolution of |
| 573 | the system clock be rounded up to the clock resolution. First | 588 | the system clock be rounded up to the clock resolution. First |
| 574 | time we are called, measure the clock tick resolution. */ | 589 | time we are called, measure the clock tick resolution. */ |