This is the mail archive of the cygwin-xfree mailing list for the Cygwin XFree86 project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: /dev/windows and select() [was Re: Slow response to keypresses in xorg-server-1.8.0-1]


We are listening and learning :-)

Dave

Sent from my iPad

On Aug 29, 2010, at 9:51 AM, "Corinna Vinschen" <corinna-cygwin@cygwin.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 immediately
>>>>>> see that when waiting on /dev/windows, it checks that the message queue has
>>>>>> old messages on it before waiting.  The MSDN documentation for
>>>>>> MsgWaitForMultipleObjects() seems to says that messages which had arrived
>>>>>> before the last PeekMessage() etc. aren't considered new and so don't end
>>>>>> the wait?
>>>>> [...]
>>> 
>>> 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
>>> 
>>>  PeekMessage (&m, (HWND) h, 0, 0, PM_NOREMOVE)
>>> 
>>> to
>>> 
>>>  PeekMessage (&m, (HWND) h, 1, UINT_MAX, PM_NOREMOVE)
>>> 
>>> 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.
>> 
>> Hmm, this ignores the potential WM_NULL message, afaics.  For some
>> reason, using
>> 
>>  PeekMessage (&m, (HWND) h, 0, UINT_MAX, PM_NOREMOVE)
>> 
>> results in MsgWaitForMultipleObjects hanging, too.  OTOH, using
>> 
>>  PeekMessage (&m, (HWND) h, 0, 16, PM_NOREMOVE)
>>  && PeekMessage (&m, (HWND) h, 17, UINT_MAX, PM_NOREMOVE)
>> 
>> does not.  Go figure.
> 
> Yeah, I realize I'm talking to myself, but this works, too:
> 
>  PeekMessage (&m, (HWND) h, 0, UINT_MAX - 1, PM_NOREMOVE)
> 
> 
> Corinna
> 
> -- 
> Corinna Vinschen                  Please, send mails regarding Cygwin to
> Cygwin Project Co-Leader          cygwin AT cygwin DOT com
> Red Hat
> 
> --
> 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/
> 

--
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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]