emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: signal handling bogosities


From: Jan D.
Subject: Re: signal handling bogosities
Date: Tue, 31 Dec 2002 17:54:36 +0100 (MET)

> 
>     FWIW, I believe Xemacs uses a home-brewed event loop.  which allows
>     it to support such things as opening both X and text-terminal frames
>     in the same Emacs instance, for example.  very nifty.
> 
> The XEmacs developers told me 10 years ago that XEmacs used an
> inside-out structure, where Xt implements the event loop and calls
> Emacs to handle each events.  That unnatural structure makes it
> impossible to write your own loop in Lisp.  I rejected it.

One could argue that for a GUI application the XEmacs approach is the
natural loop :-)

> They told me that it was impossible to handle Xt with a natural
> structure, where the event loop uses the toolkit as a subroutine, but
> we did it.  (Actually I think Paul Reilly did it.)

But not without problems as this discussion shows.  Also, there are some
code just to overcome these problems (timers for example) that feels
like a kludge.  I see that Emacs does some polling when running under
X, there is a timeout for about half a second for each select call.
I don't know why, but I guess it is related.  This makes it hard
to debug events, if nothing else.

I read a paper about event loops on the net some time ago (no URL, sorry),
and it described the problems of integrating several event models.
Say you have some GUI toolkit, perhaps CORBA, some database access
toolkit, and a custom event loop for your application.  Trying to
integrate these into one loop is never easy since all these toolkits usually
assume you run their event loop and nothing else.  Some are more integration-
friendly than others (X/Xt is very friendly, GTK is very unfriendly).
Threads to the rescue, but that is not always that easy either.

> I will not accept that unnatural structure now, any more than I did 10
> years ago.  However, I won't reject all possible changes in the event
> loop.  It might be useful to rewrite the event loop in Lisp (keeping
> its present natural structure).

I haven't looked at this in detail, but it seems to me that a lot could be
gained if Emacs could wait for events in some toolkit specific routine,
like XtAppNextEvent for Xt.  Now it looks to me it does a select for
the X connection file descriptor.  The difference is that if we use
a toolkit routine, timers, signal handlers and idle callbacks and
possible other stuff the toolkit wants to do, gets handled normally.

Has this been considered?  It doesn't solve the redrawing while executing
lisp, but helps a bit.

        Jan D.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]