lwip-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lwip-devel] lwip sockets and the level of thread safety


From: Taranowski, Thomas \(SWCOE\)
Subject: [lwip-devel] lwip sockets and the level of thread safety
Date: Fri, 2 Mar 2007 20:35:39 -0600

I have a pretty compelling reason to spend the time to make the lwIP
socket interface thread safe.  However, I don't currently have an idea
as to what aspects of the socket layer are presenting problems.  

Of course, I understand how to make thread-safe implementations, I'm
just looking to get a head start.  Thankfully, bug report 19162 provides
some information.  However, I'm still not sure about the following:

1.) Assume that multiple threads are running, each with owning their own
netconn instance (or socket).  Is it safe to multithread the
netconn_send(), or will I need to serialize access to the netconn_send()
call via mutex, assuming that a different netconn is passed into each
netconn_send call.

2.) Is it safe to thread calls to the socket functions, provided that
each call to a socket function uses a different socket instance?  In
other words, is it true that in the current implementation, a single
socket instance should be used only in a single thread? 

I hope the above is clear enough.  I've got some sort of brain damage
going on today.

Thanks,
Tom

 
> -----Original Message-----
> From: address@hidden
> [mailto:address@hidden
On
> Behalf Of Kieran Mansley
> Sent: Tuesday, February 27, 2007 12:54 AM
> To: Kieran Mansley; Rob Stedman; address@hidden
> Subject: [lwip-devel] [bug #19162] lwip_sendto: possible to corrupt
> remoteaddr/port connection state
> 
> 
> Update of bug #19162 (project lwip):
> 
>                 Severity:              3 - Normal => 1 - Wish
>               Item Group:        Faulty Behaviour => Change Request
> 
>     _______________________________________________________
> 
> Follow-up Comment #1:
> 
> You're right about the assumption that there's only one calling thread
per
> netconn.  That is a deliberate decision to keep things simple, and in
most
> cases will be true.  If a resource of any sort is used from two or
more
> threads, it is usually up to the threads to synchronize access to it,
and
> in
> this respect a netconn is no different.
> 
> It does differ to what people might expect though, so perhaps we need
to
> document this aspect of the API better.
> 
> An alternative would be to overhaul the sockets API as you suggest and
> make
> it thread safe.  I think that is unlikely to happen, but leave the
option
> open for others if they wish to do this.
> 
>     _______________________________________________________
> 
> Reply to this item at:
> 
>   <http://savannah.nongnu.org/bugs/?19162>
> 
> _______________________________________________
>   Message sent via/by Savannah
>   http://savannah.nongnu.org/
> 
> 
> 
> _______________________________________________
> lwip-devel mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/lwip-devel




reply via email to

[Prev in Thread] Current Thread [Next in Thread]