summaryrefslogtreecommitdiff
path: root/nt
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2012-09-30 17:49:05 +0200
committerEli Zaretskii <eliz@gnu.org>2012-09-30 17:49:05 +0200
commitc06c382ae494c4129da43f2c1ea0f72e39a45bf1 (patch)
tree653f7b01aa6f0d91495440a111e8198273aa28e6 /nt
parent8223b1d23361b74ede10bac47974ce7803804380 (diff)
downloademacs-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 'nt')
-rw-r--r--nt/ChangeLog12
-rw-r--r--nt/config.nt2
-rw-r--r--nt/inc/ms-w32.h4
-rw-r--r--nt/inc/sys/time.h15
4 files changed, 30 insertions, 3 deletions
diff --git a/nt/ChangeLog b/nt/ChangeLog
index 7e064cc3e42..9bc9ee6b10d 100644
--- a/nt/ChangeLog
+++ b/nt/ChangeLog
@@ -1,3 +1,15 @@
+2012-09-30 Eli Zaretskii <eliz@gnu.org>
+
+ * inc/sys/time.h (ITIMER_REAL, ITIMER_PROF): Define.
+ (struct itimerval): Define.
+ (getitimer, setitimer): Add prototypes.
+
+ * inc/ms-w32.h <sigset_t> [_MSVC_VER]: Make the typedef consistent
+ with MinGW.
+ (SA_RESTART, SIGPROF): Define.
+
+ * config.nt (HAVE_SETITIMER): Define to 1.
+
2012-09-30 Juanma Barranquero <lekktu@gmail.com>
* config.nt: Sync with autogen/config.in.
diff --git a/nt/config.nt b/nt/config.nt
index 3b398eae04c..e342c78e20f 100644
--- a/nt/config.nt
+++ b/nt/config.nt
@@ -774,7 +774,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#define HAVE_SENDTO 1
/* Define to 1 if you have the `setitimer' function. */
-#undef HAVE_SETITIMER
+#define HAVE_SETITIMER 1
/* Define to 1 if you have the `setlocale' function. */
#define HAVE_SETLOCALE 1
diff --git a/nt/inc/ms-w32.h b/nt/inc/ms-w32.h
index 107ab6e788b..646ede57c8d 100644
--- a/nt/inc/ms-w32.h
+++ b/nt/inc/ms-w32.h
@@ -121,7 +121,7 @@ extern char *getenv ();
#include <sys/types.h>
#ifdef _MSC_VER
-typedef unsigned long sigset_t;
+typedef int sigset_t;
typedef int ssize_t;
#endif
@@ -130,6 +130,7 @@ struct sigaction {
void (_CALLBACK_ *sa_handler)(int);
sigset_t sa_mask;
};
+#define SA_RESTART 0
#define SIG_BLOCK 1
#define SIG_SETMASK 2
#define SIG_UNBLOCK 3
@@ -293,6 +294,7 @@ struct timespec
#define SIGPIPE 13 /* Write on pipe with no readers */
#define SIGALRM 14 /* Alarm */
#define SIGCHLD 18 /* Death of child */
+#define SIGPROF 19 /* Profiling */
#ifndef NSIG
#define NSIG 23
diff --git a/nt/inc/sys/time.h b/nt/inc/sys/time.h
index db54c90cf1f..c12c194fd2a 100644
--- a/nt/inc/sys/time.h
+++ b/nt/inc/sys/time.h
@@ -2,7 +2,8 @@
#define SYS_TIME_H_INCLUDED
/*
- * sys/time.h doesn't exist on NT
+ * sys/time.h either doesn't exist on Windows, or doesn't necessarily
+ * have the below stuff.
*/
struct timeval
@@ -19,6 +20,18 @@ struct timezone
void gettimeofday (struct timeval *, struct timezone *);
+#define ITIMER_REAL 0
+#define ITIMER_PROF 1
+
+struct itimerval
+{
+ struct timeval it_interval; /* timer interval */
+ struct timeval it_value; /* current value */
+};
+
+int getitimer (int, struct itimerval *);
+int setitimer (int, struct itimerval *, struct itimerval *);
+
#endif /* SYS_TIME_H_INCLUDED */
/* end of sys/time.h */