You are using the wrong examples, which may be why you
don't understand the problem Mark identified.

--- Christopher Friesen <[EMAIL PROTECTED]> wrote:
> There have always been possible issues with
> concurrent access to 
> sockets/fds.
> <snip>
> Or consider calling lseek() from one task, while
> doing successive read() 
> calls in the other.

I think all but the most clueless programmer would
know that lseek() and read() need to be in a critical
section. That is not the point. We are not talking
about thread-safe across calls. We are talking about
thread-safety for a given call.

In the case of lseek() and read(), you can use
pread(). pread() is cool because you don't need to
protect it with a critical section. Two threads can do
a pread() to different offsets on the same file
handle. If you protect the pread() with a critical
section, you are just wasting code, which is sloppy.
When reading the doc for sendmsg, it appears you can
avoid the critical section for sendmsg as well, but as
Mark points out, you need the critical section unless
you are running on Windows.

ben 
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to