Possibly incorrect explanation of how WaitForSomething works (and how to fix it) [RC and CGF please comment]

Christopher Faylor cgf@redhat.com
Wed Apr 11 13:10:00 GMT 2001


On Tue, Apr 10, 2001 at 11:28:33PM -0400, Pierre A. Humblet wrote:
>Chris,
>
>I am currently trying to understand select().
>I see the following in the code:
>****************
>peek_windows (select_record *me, int)
>{
>  MSG m;
>  HANDLE h;
>  set_handle_or_return_if_not_open (h, me);
>
>  if (me->read_selected && me->read_ready)
>    return 1;
>
>  if (PeekMessage (&m, (HWND) h, 0, 0, PM_NOREMOVE))
>    {
>      me->read_ready = TRUE;
>      select_printf ("window %d(%p) ready", me->fd, me->fh->get_handle ());
>      return 1;
>    }
>***************
>What is this used for?
>
>The current problem is not to get mouse and keyboard input,
>there is already code for that. The problem is to wake up
>when some input happen, and not every 10 ms.

I don't know what you mean.  Read up on the PeekMessage call in MSDN.

As I have previously explained, there are many cases in Windows where
the only way to implement select is via polling.  This is one of those
cases, apparently.

If you have specific questions on an implementation detail, I'll try
to accomodate you but "What is this used for?" is just too broad a
question.

cgf



More information about the Cygwin-xfree mailing list