Force blocking read after EAGAIN?
Posted
by Daniel Trebbien
on Stack Overflow
See other posts from Stack Overflow
or by Daniel Trebbien
Published on 2010-05-21T23:18:52Z
Indexed on
2010/05/21
23:20 UTC
Read the original article
Hit count: 196
I have a file descriptor that is open for reading which may be non-blocking. What I need to do is simply read all data until reaching EOF and write that data to a writable file descriptor. As the process that performs this copying is not "aware" of anything that is going on around it, I don't think that I can do something useful while waiting for data, and I don't want to use a while
loop (while errno
is not EAGAIN
) because I think that it would be wasteful. Is there a way to block or otherwise suspend execution of the copying process until data becomes available?
© Stack Overflow or respective owner