[tolj@wapme-systems.de: Re: Problem with accept?!!

Corinna Vinschen vinschen@redhat.com
Tue Jun 3 12:01:00 GMT 2003

On Tue, Jun 03, 2003 at 01:31:13PM +0200, Corinna Vinschen wrote:
> On Tue, Jun 03, 2003 at 01:19:21PM +0200, Thomas Pfaff wrote:
> > If you see a chance to use cygwin_select instead of winsock_select than 
> > there is no need to terminate the threads since they must not be used at 
> > all, the accept/connect thread stuff can be moved in the mainthread 
> > since cygwin_select is already interruptible.
> Well... I was a bit reluctant to use cygwin_select directly since it
> produces so much overhead and I didn't want to mess something up.

FYI, I've just switch accept() to use cygwin_select instead of its own
thread.  Works like a charm.  fhandler_socket::accept looks like this:

  if (!is_nonblocking ())
      fd_set rfd;
      FD_ZERO (&rfd);
      FD_SET (fd, &rfd);
      res = cygwin_select (fd + 1, &rfd, NULL, NULL, NULL);
      if (res == -1)
        return -1;
  res = ::accept (get_socket (), peer, len);

This looks somehow too easy to be really correct...

Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Developer                                mailto:cygwin@cygwin.com
Red Hat, Inc.

More information about the Cygwin-developers mailing list