timeout with read operations

G. S. Hayes sjdevnull at yahoo.com
Thu Jul 22 12:33:59 EDT 2004


P at draigBrady.com wrote in message news:<40FF9069.3000904 at draigBrady.com>...
> Jim wrote:

> > but .. what if between the select and read call something happens and
> > the read blocks indefinitly?
> 
> I don't think anything could happen
> that would cause a block.

Another process could start up and hog the disk.

A cable could be loose.

Actually, I think select() on a regular file always returns readable
(except if you're at EOF maybe?)

In practice, it's unlikely that you'll block for very long, which is
sufficient for many applications.

> If you find this is not the case you can
> always make the fileno non blocking

O_NONBLOCK has no effect on regular files--see my other reply in this
thread.

Sumner



More information about the Python-list mailing list