This is the mail archive of the cygwin@sourceware.cygnus.com mailing list for the Cygwin project.


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

A possible bug in select()?


Hi,

Here's what happens on my system in XEmacs built with cygwin. In file
src/event-msw.c, there is the following code:

-------------- cut here --------------

static void
mswindows_need_event (int badly_p)
{
  int active;

  if (mswindows_in_modal_loop)
    {
      mswindows_need_event_in_modal_loop (badly_p);
      return;
    }

  while (NILP (mswindows_u_dispatch_event_queue)
         && NILP (mswindows_s_dispatch_event_queue))
    {
#ifdef HAVE_MSG_SELECT
      int i;
      SELECT_TYPE temp_mask = input_wait_mask;
      EMACS_TIME sometime;
      EMACS_SELECT_TIME select_time_to_block, *pointer_to_this;

      if (badly_p)
        pointer_to_this = 0;
      else
        {
          EMACS_SET_SECS_USECS (sometime, 0, 0);
          EMACS_TIME_TO_SELECT_TIME (sometime, select_time_to_block);
          pointer_to_this = &select_time_to_block;
        }

      active = select (MAXDESC, &temp_mask, 0, 0, pointer_to_this);

      if (active == 0)
        {
          assert (!badly_p);
          return;               /* timeout */
        }

-------------- cut here --------------

On my system, this assert at the end happens now and then, esp. when
I'm running gnus, and there is some windows showing - hiding activity.
As far as I could understand, this should not happen according to
select() docs - i.e. if (badly_p), select() is called with the timeout
parameter set to 0, which means a blocking call. I have put a
workaraound in my copy of event-msw.c, which basically has a while
loop around select(), and it helps - but does not seem right to me.
Anybody got any ideas? Thanks.

FWIW, I've been seeing this since XEmacs 21.2.b26, and a mid-december
snapshot of cygwin. I'm using the net relase 1.1 now, and XEmacs
21.2.b33. I do have an impression that the situation became harder to
repro with cygwin 1.1, but it still happened.

$uname -a
$CYGWIN_NT-4.0 LUCY 1.1.0(0.17/3/2) 2000-03-01 00:15:19 i686 unknown

-- 
Cheers,
-Dima.


--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com


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