[Python-Dev] Re: PEP 324 (process module)

Chris McDonough chrism at plope.com
Wed Aug 4 18:46:56 CEST 2004


On Wed, 2004-08-04 at 12:25, Peter Astrand wrote:
> > > Why not avoid threads on POSIX systems, and use select instead? My module
> > > does, although it does not provide an event-like IO interface. If you get
> > > rid of the threads, then you don't need the workaround code for Linux.
> >
> > Doesn't select() effectively busy-wait on "real" files (pipes and file
> > descriptors obtained via open(), as opposed to network sockets) on most
> > (all?) UNIXen?  At least this has been my finding under Linux.
> 
> Yes, but a solution with threads will have problems as well, since read()
> and friends will return EOF rather than block when you reach the end.

As I've found, if the end of the pipes in that represent the child's
stderr/stdout fds are closed in the parent, a select() reading the
"other" ends of these pipes will busywaut (at least on Linux).  Other
than than, I think this  select() would be the absolute right thing on
POSIX rather than using threads or polling.  Is there a way around this
problem or is it just a fact of life?

- C




More information about the Python-Dev mailing list