delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2010/08/29/11:09:17

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=3.0 required=5.0 tests=AWL,BAYES_00,DONT_USE_RAW_EMAIL_IN_BODY
X-Spam-Check-By: sourceware.org
References: <4BDC3161 DOT 9070101 AT cornell DOT edu> <4BDDE5F1 DOT 9080204 AT cornell DOT edu> <4C2B8171 DOT 5020409 AT dronecode DOT org DOT uk> <4C5B08AE DOT 4080902 AT pobox DOT com> <AANLkTin9mOFFkk21dYf+CT2uMXr=x5bnaNsTkH0w0cka AT mail DOT gmail DOT com> <4C5DD910 DOT 9050809 AT dronecode DOT org DOT uk> <AANLkTin6e74L1_Z7KzoOVmynQ+eW6a8tkTK_A21-mpg+@mail.gmail.com> <4C7A62FD DOT 10506 AT dronecode DOT org DOT uk> <20100829141716 DOT GG6726 AT calimero DOT vinschen DOT de> <20100829144150 DOT GI6726 AT calimero DOT vinschen DOT de> <20100829145041 DOT GJ6726 AT calimero DOT vinschen DOT de>
Message-ID: <75D6C200-C94D-4705-8D9A-5365EE0A2A28@informatica.com>
From: "Trollope, David" <dtrollope AT informatica DOT com>
To: <cygwin-xfree AT cygwin DOT com>
In-Reply-To: <20100829145041.GJ6726@calimero.vinschen.de>
MIME-Version: 1.0 (iPad Mail 7B500)
Subject: Re: /dev/windows and select() [was Re: Slow response to keypresses in xorg-server-1.8.0-1]
Date: Sun, 29 Aug 2010 09:58:07 -0500
Cc: <cygwin AT cygwin DOT com>, <cygwin-xfree AT cygwin DOT com>
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

We are listening and learning :-)

Dave

Sent from my iPad

On Aug 29, 2010, at 9:51 AM, "Corinna Vinschen" <corinna-cygwin AT cygwin DOT com>=
 wrote:

> On Aug 29 16:41, Corinna Vinschen wrote:
>> On Aug 29 16:17, Corinna Vinschen wrote:
>>> On Aug 29 14:39, Jon TURNEY wrote:
>>>> On 08/08/2010 12:04, Andy Koppe wrote:
>>>>> On 7 August 2010 23:07, Jon TURNEY wrote:
>>>>>> Hmmm, looking again at the implementation of select(), I don't immed=
iately
>>>>>> see that when waiting on /dev/windows, it checks that the message qu=
eue has
>>>>>> old messages on it before waiting.  The MSDN documentation for
>>>>>> MsgWaitForMultipleObjects() seems to says that messages which had ar=
rived
>>>>>> before the last PeekMessage() etc. aren't considered new and so don'=
t end
>>>>>> the wait?
>>>>> [...]
>>>=20
>>> Thanks for the testcase.  I examined this and I think I have a
>>> workaround.  MSDN states that there's a flag QS_ALLPOSTMESSAGE for
>>> MsgWaitForMultipleObjects, which is not cleared by PeekMessage, if the
>>> wMsgFilterMin and wMsgFilterMax arguments are not both 0.  So, what I
>>> did was to add the QS_ALLPOSTMESSAGE flag to the
>>> MsgWaitForMultipleObjects call in select.cc, and to change the
>>> PeekMessage call in select.cc:peek_windows() from
>>>=20
>>>  PeekMessage (&m, (HWND) h, 0, 0, PM_NOREMOVE)
>>>=20
>>> to
>>>=20
>>>  PeekMessage (&m, (HWND) h, 1, UINT_MAX, PM_NOREMOVE)
>>>=20
>>> Same in your above test application.  This appears to do the trick.
>>> However, I'm not exactly sure if that's a valid fix.  Patch below.
>>=20
>> Hmm, this ignores the potential WM_NULL message, afaics.  For some
>> reason, using
>>=20
>>  PeekMessage (&m, (HWND) h, 0, UINT_MAX, PM_NOREMOVE)
>>=20
>> results in MsgWaitForMultipleObjects hanging, too.  OTOH, using
>>=20
>>  PeekMessage (&m, (HWND) h, 0, 16, PM_NOREMOVE)
>>  && PeekMessage (&m, (HWND) h, 17, UINT_MAX, PM_NOREMOVE)
>>=20
>> does not.  Go figure.
>=20
> Yeah, I realize I'm talking to myself, but this works, too:
>=20
>  PeekMessage (&m, (HWND) h, 0, UINT_MAX - 1, PM_NOREMOVE)
>=20
>=20
> Corinna
>=20
> --=20
> Corinna Vinschen                  Please, send mails regarding Cygwin to
> Cygwin Project Co-Leader          cygwin AT cygwin DOT com
> Red Hat
>=20
> --
> Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
> Problem reports:       http://cygwin.com/problems.html
> Documentation:         http://x.cygwin.com/docs/
> FAQ:                   http://x.cygwin.com/docs/faq/
>=20

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019