Looked around, but could not find any link justifying the answer for AF_UNIX sockets.
My implementation is on a linux system, I have an AF_UNIX SOCK_STREAM socket,
My question is - are AF_UNIX socket 'send()' thread safe? If I have threads parallely/concurrently calling send on the AF_UNIX socket fd, will kernel take care of the synchronization?
I went through multiple links, but all are related to TCP/UDP (AF_INET) sockets, so if anyone could suggest a link that justifies the answer, or could provide some insight into the kernel code, it would be of great help.
POSIX specifies that all functions it defines must be thread-safe, except those on a list of specific exceptions. The send(2)
function is defined by POSIX and is not included on the list of exceptions. Inasmuch as the Linux implementation of send(2)
purports to conform to POSIX specifications, you can rely on it to be thread-safe.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With