[omniORB] Mingw win32 bug

Al Slater al.slater at scluk.com
Mon Sep 13 15:42:59 BST 2004


Duncan Grisby wrote:
> On Monday 13 September, "Al Slater" wrote:
> 
>>> Please can you try the latest CVS?  I've changed one thing that
>>> might fix the problem. If it still doesn't work, try taking out the
>>> #ifndef __WIN32__ on line 418 and report if that works.
>> 
>> I got the latest from cvs which is version 1.1.2.22 and removed the
>> #ifndef on line 408 (not 418) and recompiled.  Everything worked fine
>> then.
> 
> The anonymous CVS is clearly a bit behind the times. The
> latest version is 1.1.2.23. Anyway, your reply tells me what
> I wanted to know. select() on Windows doesn't need the first
> parameter to be set to the number of file descriptors in the
> set. Clearly mingw does. What defines does mingw set?  How does it
> implement fd_sets? 

<START clip from SocketCollection.cc>

  int fd = 0;

#ifndef __WIN32__
  // Win32 ignores the first argument to select()
  while (total) {
    if (FD_ISSET(fd,&rfds)) {
      maxfd = fd;
      total--;
    }
    fd++;
  }
#endif

  int nready;

  if (fd != 0) {
#ifndef GDB_DEBUG
    nready = select(maxfd+1,&rfds,0,0,&timeout);
#else
    nready = do_select(maxfd+1,&rfds,0,0,&timeout);
#endif
  }
  else {
    omni_tracedmutex_lock sync(pd_fdset_lock);
    pd_select_cond.timedwait(pd_abs_sec,pd_abs_nsec);
    // The condition variable should be poked so we are woken up
    // immediately when there is something to monitor.  We cannot use
    // select(0,0,0,0,&timeout) because win32 doesn't like it.
    nready = 0; // simulate a timeout
  }
 
<END clip from SocketCollection.cc>

If I am reading the above code correctly, fd is set to 0 at the
beginning.  If __WIN32__ is true then the while loop is ommitted (so fd
is never set to anything) and then select is only called if fd is not
equal to 0.  So, is the select never being called on win32?

Regards 
Al

> Cheers,
> 
> Duncan.






More information about the omniORB-list mailing list