[lkml]   [2006]   [May]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: send(), sendmsg(), sendto() not thread-safe
Followup to:  <>
By author: Mark A Smith <>
In newsgroup:
> I discovered that in some cases, send(), sendmsg(), and sendto() are not
> thread-safe. Although the man page for these functions does not specify
> whether these functions are supposed to be thread-safe, my reading of the
> POSIX/SUSv3 specification tells me that they should be. I traced the
> problem to tcp_sendmsg(). I was very curious about this issue, so I wrote
> up a small page to describe in more detail my findings. You can find it at:
> .
> Thanks,
> Mark A. Smith
> PS. I am using the term "thread" in the general sense, this is a problem
> independent of pthreads, etc. The problem occurs when two processes
> (whether or not they share an address space) send on the same socket (and
> some other low-resource conditions exist).

User error. Writes onto a streaming socket (or a pipe) are
thread-safe, *but not necessarily atomic*, if the size exceeds PIPE_BUF.

If you want atomicity you either have to do your own locking, or use a


To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2006-05-16 00:27    [W:0.071 / U:2.388 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site