lock_sock()

From: Mahesh Mahadevan (bf80979@yahoo.com)
Date: Mon Jul 31 2000 - 19:53:03 EST


Hi,
 
I noticed that the TCP code (linux 2.2.14) locks the
socket (using lock_sock()) before doing a send
(tcp_do_sendmsg), and during a receive
(tcp_recvmsg).
Besides that, I have seen lock_sock() being called
at a number of other places in the TCP code.
 
Could someone please explain to me the working of
lock_sock(), and in what cases it should be called?

The reason I am looking at lock_sock is because I
have a project in which I create 2 INET sockets (say
s1
and s2), and each socket can receive data, that it
sends down through the other. For ex: s1 receives some
data, processes it, and sends it through s2, and vice
versa.
I think I have to lock the socket that I am sending
data down on, but am not too sure if I have to lock
the receiving socket as well.
Any help or tips would be very much appreciated.

Thanks,
Mahesh.

__________________________________________________
Do You Yahoo!?
Kick off your party with Yahoo! Invites.
http://invites.yahoo.com/

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Mon Jul 31 2000 - 21:00:35 EST