简体   繁体   中英

Is the write() function in C blocking or non-blocking?

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM