tru64-unix-managers (formerly alpha-osf-managers) (1994-2012)
 help / color / mirror / Atom feed
* select and poll with nonblocking file descriptors
@ 1997-07-30 20:32 waisadm
  0 siblings, 0 replies; only message in thread
From: waisadm @ 1997-07-30 20:32 UTC (permalink / raw)
  To: tru64-unix-managers


In Digital Unix 4.0, select and poll have a "feature" which I'm
finding very frustrating as I try to port an application which is
heavy with non-blocking I/O.  Quoting from "man select":

  [Digital] Objects ready for the requested operation are those which
  the operation would not block and not necessarily those which have
  data available for the operation.

True to the man page, select returns immediately if any file
descriptor in the fdset is non-blocking, even if there's no data
available.  Poll works the same way, unsurprisingly.  So my question
is, if I'm working with file descriptors for sockets or named pipes
which are non-blocking, how can I block in select or poll until there
really is data available to read?  This is the behavior I see in
Linux, HPUX, AIX, and Solaris, and it's the behavior expected by the
application I'm porting.

One approach that I've tried without success is to save, modify, and
restore the fd flags around the select call using fcntl.  Curiously,
turning off O_NONBLOCK before calling select had no apparent effect.
A bug?

Thanks in advance for any light you can shed on this problem.  And
also thanks for getting me this far -- it was only by searching this
list's archive that I discovered how to make g++ and libg++ compile
and install successfully.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1997-07-30 20:32 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1997-07-30 20:32 select and poll with nonblocking file descriptors waisadm

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox