diff options
author | Eli Zaretskii <eliz@gnu.org> | 2012-09-30 17:49:05 +0200 |
---|---|---|
committer | Eli Zaretskii <eliz@gnu.org> | 2012-09-30 17:49:05 +0200 |
commit | c06c382ae494c4129da43f2c1ea0f72e39a45bf1 (patch) | |
tree | 653f7b01aa6f0d91495440a111e8198273aa28e6 /src/w32.c | |
parent | 8223b1d23361b74ede10bac47974ce7803804380 (diff) | |
download | emacs-c06c382ae494c4129da43f2c1ea0f72e39a45bf1.tar.gz |
Support atimers and CPU profiler via profile.c on MS-Windows.
src/w32proc.c (sig_mask, crit_sig): New static variables.
(sys_signal): Support SIGALRM and SIGPROF.
(sigemptyset, sigaddset, sigfillset, sigprocmask)
(pthread_sigmask, setpgrp): Moved here from w32.c. sigaddset,
sigfillset, and sigprocmask are no longer no-ops.
(sigismember): New function.
(struct itimer_data): New definition.
(ticks_now, real_itimer, prof_itimer, clocks_min, crit_real)
(crit_prof): New static variables.
(MAX_SINGLE_SLEEP): New definition.
(timer_loop, stop_timer_thread, term_timers, init_timers)
(start_timer_thread, getitimer, setitimer): New functions.
(alarm): No longer a no-op, calls setitimer.
src/w32.c (term_ntproc): Call term_timers.
(init_ntproc): Make sure all signals are unblocked at startup, to
erase any traces of dumping. Call init_timers.
src/w32fns.c (hourglass_timer, HOURGLASS_ID): Remove.
Windows-specific code to display the hourglass mouse pointer is no
longer used.
(w32_wnd_proc): Remove code that handled the WM_TIMER message due
to hourglass timer expiration.
(start_hourglass, cancel_hourglass, DEFAULT_HOURGLASS_DELAY):
Remove, no longer used.
(w32_note_current_window, show_hourglass, hide_hourglass): New
functions, in support of hourglass cursor display similar to other
window systems.
(syms_of_w32fns): Don't initialize hourglass_timer.
src/xdisp.c (start_hourglass, cancel_hourglass): Now used on
WINDOWSNT as well.
(start_hourglass) [WINDOWSNT]: Call w32_note_current_window.
src/w32.h (init_timers, term_timers): Add prototypes.
nt/inc/sys/time.h (ITIMER_REAL, ITIMER_PROF): Define.
(struct itimerval): Define.
(getitimer, setitimer): Add prototypes.
nt/inc/ms-w32.h <sigset_t> [_MSVC_VER]: Make the typedef consistent
with MinGW.
(SA_RESTART, SIGPROF): Define.
nt/config.nt (HAVE_SETITIMER): Define to 1.
Diffstat (limited to 'src/w32.c')
-rw-r--r-- | src/w32.c | 58 |
1 files changed, 11 insertions, 47 deletions
diff --git a/src/w32.c b/src/w32.c index 3154c725abf..7977e979b13 100644 --- a/src/w32.c +++ b/src/w32.c @@ -1528,52 +1528,6 @@ is_unc_volume (const char *filename) return 1; } -/* Routines that are no-ops on NT but are defined to get Emacs to compile. */ -int -sigemptyset (sigset_t *set) -{ - *set = 0; - return 0; -} - -int -sigaddset (sigset_t *set, int signo) -{ - return 0; -} - -int -sigfillset (sigset_t *set) -{ - return 0; -} - -int -sigprocmask (int how, const sigset_t *set, sigset_t *oset) -{ - return 0; -} - -int -pthread_sigmask (int how, const sigset_t *set, sigset_t *oset) -{ - if (sigprocmask (how, set, oset) == -1) - return EINVAL; - return 0; -} - -int -setpgrp (int pid, int gid) -{ - return 0; -} - -int -alarm (int seconds) -{ - return 0; -} - #define REG_ROOT "SOFTWARE\\GNU\\Emacs" LPBYTE @@ -6623,6 +6577,9 @@ void term_ntproc (int ignored) { (void)ignored; + + term_timers (); + /* shutdown the socket interface if necessary */ term_winsock (); @@ -6632,6 +6589,8 @@ term_ntproc (int ignored) void init_ntproc (int dumping) { + sigset_t initial_mask = 0; + /* Initialize the socket interface now if available and requested by the user by defining PRELOAD_WINSOCK; otherwise loading will be delayed until open-network-stream is called (w32-has-winsock can @@ -6708,7 +6667,12 @@ init_ntproc (int dumping) /* unfortunately, atexit depends on implementation of malloc */ /* atexit (term_ntproc); */ if (!dumping) - signal (SIGABRT, term_ntproc); + { + /* Make sure we start with all signals unblocked. */ + sigprocmask (SIG_SETMASK, &initial_mask, NULL); + signal (SIGABRT, term_ntproc); + } + init_timers (); /* determine which drives are fixed, for GetCachedVolumeInformation */ { |