aboutsummaryrefslogtreecommitdiffstats
path: root/src/w32.c
diff options
context:
space:
mode:
authorEli Zaretskii2012-09-30 17:49:05 +0200
committerEli Zaretskii2012-09-30 17:49:05 +0200
commitc06c382ae494c4129da43f2c1ea0f72e39a45bf1 (patch)
tree653f7b01aa6f0d91495440a111e8198273aa28e6 /src/w32.c
parent8223b1d23361b74ede10bac47974ce7803804380 (diff)
downloademacs-c06c382ae494c4129da43f2c1ea0f72e39a45bf1.tar.gz
emacs-c06c382ae494c4129da43f2c1ea0f72e39a45bf1.zip
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.c58
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)
1528 return 1; 1528 return 1;
1529} 1529}
1530 1530
1531/* Routines that are no-ops on NT but are defined to get Emacs to compile. */
1532int
1533sigemptyset (sigset_t *set)
1534{
1535 *set = 0;
1536 return 0;
1537}
1538
1539int
1540sigaddset (sigset_t *set, int signo)
1541{
1542 return 0;
1543}
1544
1545int
1546sigfillset (sigset_t *set)
1547{
1548 return 0;
1549}
1550
1551int
1552sigprocmask (int how, const sigset_t *set, sigset_t *oset)
1553{
1554 return 0;
1555}
1556
1557int
1558pthread_sigmask (int how, const sigset_t *set, sigset_t *oset)
1559{
1560 if (sigprocmask (how, set, oset) == -1)
1561 return EINVAL;
1562 return 0;
1563}
1564
1565int
1566setpgrp (int pid, int gid)
1567{
1568 return 0;
1569}
1570
1571int
1572alarm (int seconds)
1573{
1574 return 0;
1575}
1576
1577#define REG_ROOT "SOFTWARE\\GNU\\Emacs" 1531#define REG_ROOT "SOFTWARE\\GNU\\Emacs"
1578 1532
1579LPBYTE 1533LPBYTE
@@ -6623,6 +6577,9 @@ void
6623term_ntproc (int ignored) 6577term_ntproc (int ignored)
6624{ 6578{
6625 (void)ignored; 6579 (void)ignored;
6580
6581 term_timers ();
6582
6626 /* shutdown the socket interface if necessary */ 6583 /* shutdown the socket interface if necessary */
6627 term_winsock (); 6584 term_winsock ();
6628 6585
@@ -6632,6 +6589,8 @@ term_ntproc (int ignored)
6632void 6589void
6633init_ntproc (int dumping) 6590init_ntproc (int dumping)
6634{ 6591{
6592 sigset_t initial_mask = 0;
6593
6635 /* Initialize the socket interface now if available and requested by 6594 /* Initialize the socket interface now if available and requested by
6636 the user by defining PRELOAD_WINSOCK; otherwise loading will be 6595 the user by defining PRELOAD_WINSOCK; otherwise loading will be
6637 delayed until open-network-stream is called (w32-has-winsock can 6596 delayed until open-network-stream is called (w32-has-winsock can
@@ -6708,7 +6667,12 @@ init_ntproc (int dumping)
6708 /* unfortunately, atexit depends on implementation of malloc */ 6667 /* unfortunately, atexit depends on implementation of malloc */
6709 /* atexit (term_ntproc); */ 6668 /* atexit (term_ntproc); */
6710 if (!dumping) 6669 if (!dumping)
6711 signal (SIGABRT, term_ntproc); 6670 {
6671 /* Make sure we start with all signals unblocked. */
6672 sigprocmask (SIG_SETMASK, &initial_mask, NULL);
6673 signal (SIGABRT, term_ntproc);
6674 }
6675 init_timers ();
6712 6676
6713 /* determine which drives are fixed, for GetCachedVolumeInformation */ 6677 /* determine which drives are fixed, for GetCachedVolumeInformation */
6714 { 6678 {