This is the mail archive of the cygwin 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: Select() hangs forever

On Apr 28 11:48, Vladislav Grinchenko wrote:
> A small test program creates a UNIX domain socket and listens on an
> incoming connections. Then, from the same process, two ASYNC connections
> are attempted (think of it as a loopback within a process). Calling
> connect() on both returns "errno: 119 Operation now in progress" as
> expected. 
> Then, to complete the connection establishment, I call select() on both
> FDs with Read/Write mask checked to see if in fact the connection is
> completed. The timeout is set to 1 seconds (I also tried different
> timeouts). The select() BLOCKS FOREVER and never returns (until I kill
> the process). 
> I ran the program with 'strace' and attached the relevant log file. Can
> someone with working knowledge of cygwin networking code shed some light
> of what I might be doing wrong?

Nope.  Please reduce your testcase to the bare minimum(!) to reproduce
the hang and send the source code to this list.

Other than that, I'm not sure this will work reliably in Cygwin anyway.
I have strong reservations against using ASYNC mode(*).  Isn't it possible
to do the same with just using nonblocking I/O or perhaps threads?


(*) Stevens(**) explains signal-driven I/O (aka async I/O) as not very
    useful and I can easily follow his reasoning.

(**) Stevens, W. Ricahrd, "UNIX Network Programming", "Vol 1: Networking
     APIs: Sockets and XTI", Prentice Hall, ISBN 0-13-490012-X,
     Chapter 22 "Signal-Driven I/O, pp. 589

Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader
Red Hat, Inc.

Unsubscribe info:
Problem reports:

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