all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Daniel Colascione <dan.colascione@gmail.com>
To: grischka <grishka@gmx.de>
Cc: emacs-devel@gnu.org
Subject: Re: [PATCH] system-type cygwin with window-system w32
Date: Mon, 18 Jul 2011 12:11:25 -0700	[thread overview]
Message-ID: <4E24855D.5030607@gmail.com> (raw)
In-Reply-To: <4E2480E6.5040306@gmx.de>

[-- Attachment #1: Type: text/plain, Size: 3552 bytes --]

On 7/18/2011 11:38 AM, grischka wrote:
> Daniel Colascione wrote:
>> If it works, /dev/windows would allow us to get rid of not only the
>> self-pipe
>> and the clipboard thread, but the UI thread as well, though it'd be
>> easier to
>> keep the last of these for compatibility for the NT build.  Thanks.
>
> Actually the NT build works quite well with one single thread.
> Already tested here.

Do you have a patch handy?

>> By the way: why do we use a separate UI thread in the NT case at all?
>> AIUI, we
>> can do everything we need asynchronously via overlapped IO, so we
>> should never
>> have to block and not pump messages.
>
> The 'sys_select' wrapper DOES pump messages, just for the wrong
> thread.  So it needs the thread because it has the thread. :)

Of course.  I suspect the initial motivation behind the separate thread
is a long, somnolent story involving QUIT.

> Well, there are two other things needed:
> * peek for messages in the QUIT macro (say via ELSE_PENDING_SIGNALS)
>   which is for C-g to interrupt lisp.

I don't think this approach alone would be sufficient.  I may be wrong,
but I think the Windows window manager will consider a program to be
"unresponsive" if it stops actually pumping messages; I don't think
peeking is sufficient.  Also, [1] says that we shouldn't delay pumping
messages even if we're able to guarantee we'll get around to them later.
(Running lisp code is indistinguishable from sleep in this case.)

Using PeekMessage in lisp code instead of actually pumping messages
would be like telling your credit card company, "Yeah, I got the bill,
and I'll get around to responding sometime in the next two years".  I
don't think it'd go over well.

Actually, on that note, I should add a timeout to my WM_RENDERFORMAT
code: we shouldn't block other applications forever merely because Emacs
is spinning in Lisp.

> * break command_loop_1() such that it can be used to handle just one
>   event which is to handle scrollbar messages because the widgets
>   run their own message loop deep in windows.  Otherwise all the
>   scrolling would happen only after you release the mouse button.

I doubt that the scrollbar is the only special case we'd need to consider.

On 7/18/2011 11:52 AM, grischka wrote:
> Daniel Colascione wrote:
>> This requirement is incompatible
>> with using lisp code to render clipboard content: we might have
>> received a
>> window message at an inopportune time for calling back into Lisp, and
>> we can't
>> delay the response to WM_RENDERFORMAT by re-queuing or somesuch. 
>> Today's NT
>> clipboard code doesn't have to address the issue because it never
>> calls into Lisp.
> 
> Well, you can do this if you have a function to pump elisp
> events, say drain_lisp_queue():
> 
> That would be basically command_loop_1() with
>     while (1)
> replaced by
>     while (detect_input_pending())
> 
> Then, in window_proc:
>     case WM_RENDERFORMAT:
>         queue_lisp_event(); //I guess it's "kbd_buffer_store_event_hold"
>         drain_lisp_queue();
>         break;
> 
> Or such.
> 

I don't understand how this approach helps.  The problem, AIUI, isn't
that we have Lisp events, but that we read input and wait for processes
in many places, and it's hard to be confident that each place we pump
messages is a safe place to process lisp code.  I don't understand how
draining the lisp event queue would help.

[1] http://blogs.msdn.com/b/oldnewthing/archive/2006/02/10/529525.aspx


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 258 bytes --]

  reply	other threads:[~2011-07-18 19:11 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-18 17:33 [PATCH] system-type cygwin with window-system w32 grischka
2011-07-18 17:50 ` Daniel Colascione
2011-07-18 18:08   ` Daniel Colascione
2011-07-18 18:52     ` grischka
2011-07-18 19:11       ` Daniel Colascione [this message]
2011-07-18 21:01         ` grischka
2011-07-19  2:58           ` Eli Zaretskii
2011-07-19  2:59             ` Daniel Colascione
2011-07-21 17:44           ` Lennart Borgman
2011-07-22  7:30             ` Daniel Colascione
2011-07-22  7:41               ` Lennart Borgman
2011-07-22 21:24                 ` chad
2011-07-22 21:57                   ` Lennart Borgman
2011-07-18 18:38   ` grischka
  -- strict thread matches above, loose matches on Subject: below --
2011-07-18  0:01 Daniel Colascione
2011-07-18  0:06 ` Daniel Colascione
2011-07-18  6:13 ` Eli Zaretskii
2011-07-18  6:29   ` Daniel Colascione
2011-07-18  8:53     ` Eli Zaretskii
2011-07-18 10:10       ` Daniel Colascione
2011-07-18 16:04         ` Paul Eggert
2011-07-18 16:19         ` Eli Zaretskii
2011-07-18 13:55     ` Jason Rumney
2011-07-18 16:13     ` Paul Eggert
2011-07-18 17:34       ` Andreas Schwab
2011-07-18  6:53 ` Eli Zaretskii
2011-07-18  7:01   ` Daniel Colascione
2011-07-18  9:04     ` Eli Zaretskii
2011-07-18  9:41       ` Daniel Colascione
2011-07-18 10:10         ` Eli Zaretskii
2011-07-18 10:49           ` Daniel Colascione
2011-07-18 11:22             ` Juanma Barranquero
2011-07-18 16:41             ` Eli Zaretskii
2011-07-18 16:48               ` Daniel Colascione
2011-07-18 17:08                 ` Eli Zaretskii
2011-07-18 22:08             ` Richard Stallman
2011-07-18 22:24               ` Daniel Colascione
2011-07-18 22:45                 ` David Kastrup
2011-07-18 22:56                   ` Daniel Colascione
2011-07-19 16:49                     ` Richard Stallman
2011-07-21  1:44               ` Lennart Borgman
2011-07-18 22:08             ` Richard Stallman
2011-07-18 13:31       ` Jason Rumney
2011-07-18 13:46         ` Richard Riley
2011-07-18  8:42 ` Eli Zaretskii
2011-07-18 10:33   ` Daniel Colascione
2011-07-18 16:29     ` Eli Zaretskii
2011-07-18 17:04       ` Daniel Colascione
2011-07-18 15:54 ` Stefan Monnier
2011-07-18 15:55 ` Stefan Monnier
2011-07-18 17:37 ` Andreas Schwab

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4E24855D.5030607@gmail.com \
    --to=dan.colascione@gmail.com \
    --cc=emacs-devel@gnu.org \
    --cc=grishka@gmx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.