Reputation: 897
I looked on the Linux man pages for the answer but can't seem to find it. I know that read()
is blocking but I'm still not sure about write()
.
Can anyone point me to any documentation for clarification?
Upvotes: 9
Views: 15663
Reputation: 753455
Read POSIX on read()
and
write()
. See also functions such as open()
and pipe()
.
It depends on the attributes of the file descriptor you're reading from or writing to (think O_NONBLOCK
, for example), and on the underlying file type (disk file vs pipe vs FIFO vs socket vs character or block special), and so on.
Succinctly, both read()
and write()
can be blocking or non-blocking, depending on circumstances.
Upvotes: 13