This is the mail archive of the cygwin-developers@cygwin.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]
Other format: [Raw text]

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


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

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


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