Mercurial > hg > xemacs-beta
diff src/event-stream.c @ 593:5fd7ba8b56e7
[xemacs-hg @ 2001-05-31 12:45:27 by ben]
xemacs-faq.texi: Major rewrite.
Update all MS Windows info to current.
Redo section 6.1 almost completely.
Incorporate sections 1 and 2 of Hrvoje's FAQ.
etags.el: Fix infloop when going up to the root.
s\cygwin32.h: Don't unilaterally include ntplay, but only when we're compiling
with native sound (look in configure now).
event-msw.c: Fix yet more problems with C-g handling.
Implement debug-mswindows-events.
event-stream.c, events.h, signal.c, sysdep.h:
Rearrange the signal-handling code to eliminate the former
spaghetti logic paths in it. Document clearly what
"low-level" and "high-level" timeouts are. Rename some
functions with unclear names (e.g. "...alarm...") to names
that reflect what they actually do (e.g. "...async_timeout...").
Fix numerous bugs discovered in the process.
console-x.h, event-Xt.c, event-msw.c, frame-x.c:
Hopefully make XEmacs properly maintain the "iconified"
state on frames at all times. This should fix the "can't
delete a frame with C-x 5 0 when there's another iconified
frame out there" bug.
Put a notice in of further changes that should probably
be made to clean up the frame-visibility support.
(especially directed at Jan Vroonhof)
lisp.h, miscplay.c:
Rename SBufbyte to CBufbyte to avoid a misleading name.
Eliminate UChar, which is not used anywhere and contributes
no semantic info. Add a comment about the documentation-only
properties of the char/unsigned char typedefs. Add
SChar_Binary as an explicitly `signed' version of Char_Binary
and put back the `signed' declarations in miscplay.c.
alloc.c:
Use char typedefs.
console-msw.c, device-msw.c, dialog-msw.c, editfns.c, fileio.c, glyphs-eimage.c, menubar-msw.c, ntplay.c, objects-msw.c, realpath.c, redisplay-msw.c, select-msw.c, syswindows.h, win32.c:
Eliminate numerous C++ errors.
frame-msw.c:
Eliminate numerous C++ errors and Mule-ize.
glyphs-msw.c:
Eliminate numerous C++ errors and use char typedefs.
configure.in:
Fix problems detecting both native and Linux sound on Cygwin
when compiled with --with-msw=no.
Rearrange file-coding handling a bit to avoid warning when
compiling with Mule.
configure.in, configure.usage, INSTALL:
Document XEMACS_CC and corresponding compiler option --xemacs-compiler.
Explain how to build xemacs using a C++ compiler.
author | ben |
---|---|
date | Thu, 31 May 2001 12:45:41 +0000 |
parents | 183866b06e0b |
children | fdefd0186b75 |
line wrap: on
line diff
--- a/src/event-stream.c Thu May 31 12:03:39 2001 +0000 +++ b/src/event-stream.c Thu May 31 12:45:41 2001 +0000 @@ -924,12 +924,28 @@ /* timeouts */ /**********************************************************************/ -/**** Low-level timeout functions. **** +/* NOTE: "Low-level" or "interval" timeouts are one-shot timeouts that + measure single intervals. "High-level timeouts" or "wakeups" are + the objects generated by `add-timeout' or `add-async-timout' -- + they can fire repeatedly (and in fact can have a different initial + time and resignal time). Given the nature of both setitimer() and + select() -- i.e. all we get is a single one-shot timer -- we have + to decompose all high-level timeouts into a series of intervals or + low-level timeouts. + + Low-level timeouts are of two varieties: synchronous and asynchronous. + The former are handled at the window-system level, the latter in + signal.c. +*/ + +/**** Low-level timeout helper functions. **** These functions maintain a sorted list of one-shot timeouts (where - the timeouts are in absolute time). They are intended for use by - functions that need to convert a list of absolute timeouts into a - series of intervals to wait for. */ + the timeouts are in absolute time so we never lose any time as a + result of the delay between noting an interval and firing the next + one). They are intended for use by functions that need to convert + a list of absolute timeouts into a series of intervals to wait + for. */ /* We ensure that 0 is never a valid ID, so that a value of 0 can be used to indicate an absence of a timer. */ @@ -954,6 +970,8 @@ tm = Blocktype_alloc (the_low_level_timeout_blocktype); tm->next = NULL; + /* Don't just use ++low_level_timeout_id_tick, for the (admittedly + rare) case in which numbers wrap around. */ if (low_level_timeout_id_tick == 0) low_level_timeout_id_tick++; tm->id = low_level_timeout_id_tick++; @@ -1047,8 +1065,10 @@ } -/**** High-level timeout functions. ****/ - +/**** High-level timeout functions. **** */ + +/* We ensure that 0 is never a valid ID, so that a value of 0 can be + used to indicate an absence of a timer. */ static int timeout_id_tick; static Lisp_Object pending_timeout_list, pending_async_timeout_list; @@ -1098,6 +1118,10 @@ EMACS_TIME current_time; EMACS_TIME interval; + /* Don't just use ++timeout_id_tick, for the (admittedly rare) case + in which numbers wrap around. */ + if (timeout_id_tick == 0) + timeout_id_tick++; timeout->id = timeout_id_tick++; timeout->resignal_msecs = vanilliseconds; timeout->function = function; @@ -1111,9 +1135,9 @@ if (async_p) { timeout->interval_id = - event_stream_add_async_timeout (timeout->next_signal_time); - pending_async_timeout_list = noseeum_cons (op, - pending_async_timeout_list); + signal_add_async_interval_timeout (timeout->next_signal_time); + pending_async_timeout_list = + noseeum_cons (op, pending_async_timeout_list); } else { @@ -1138,7 +1162,7 @@ NOTE: The returned FUNCTION and OBJECT are *not* GC-protected at all. */ -static int +int event_stream_resignal_wakeup (int interval_id, int async_p, Lisp_Object *function, Lisp_Object *object) { @@ -1197,7 +1221,7 @@ if (async_p) timeout->interval_id = - event_stream_add_async_timeout (timeout->next_signal_time); + signal_add_async_interval_timeout (timeout->next_signal_time); else timeout->interval_id = event_stream_add_timeout (timeout->next_signal_time); @@ -1241,7 +1265,7 @@ *timeout_list = delq_no_quit_and_free_cons (op, *timeout_list); if (async_p) - event_stream_remove_async_timeout (timeout->interval_id); + signal_remove_async_interval_timeout (timeout->interval_id); else event_stream_remove_timeout (timeout->interval_id); free_managed_lcrecord (Vtimeout_free_list, op); @@ -1277,50 +1301,6 @@ } -/**** Asynch. timeout functions (see also signal.c) ****/ - -#if !defined (SIGIO) && !defined (DONT_POLL_FOR_QUIT) -extern int poll_for_quit_id; -#endif - -#if defined(HAVE_UNIX_PROCESSES) && !defined(SIGCHLD) -extern int poll_for_sigchld_id; -#endif - -void -event_stream_deal_with_async_timeout (int interval_id) -{ - /* This function can GC */ - Lisp_Object humpty, dumpty; -#if ((!defined (SIGIO) && !defined (DONT_POLL_FOR_QUIT)) \ - || defined(HAVE_UNIX_PROCESSES) && !defined(SIGCHLD)) - int id = -#endif - event_stream_resignal_wakeup (interval_id, 1, &humpty, &dumpty); - -#if !defined (SIGIO) && !defined (DONT_POLL_FOR_QUIT) - if (id == poll_for_quit_id) - { - quit_check_signal_happened = 1; - quit_check_signal_tick_count++; - return; - } -#endif - -#if defined(HAVE_UNIX_PROCESSES) && !defined(SIGCHLD) - if (id == poll_for_sigchld_id) - { - kick_status_notify (); - return; - } -#endif - - /* call1 GC-protects its arguments */ - call1_trapping_errors ("Error in asynchronous timeout callback", - humpty, dumpty); -} - - /**** Lisp-level timeout functions. ****/ static unsigned long