lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] Socket API thread safe?


From: K.J. Mansley
Subject: Re: [lwip-users] Socket API thread safe?
Date: 08 Jun 2004 13:19:33 +0100

On Tue, 2004-06-08 at 12:28, Wilfred Hoogerbrugge wrote:
> Hello group,
> 
> As the subject already shows I wonder if the lwIP socket API is multi thread
> safe.
> 
> I remember having read somewhere it is, but can’t find that statement back.
> 
> As I’m hunting a race condition in my environment using lwIP + socket API, I
> wonder if the problem my lay in the fact I’ve two threads calling the socket
> API (one for sending using sendto and one for receiving using recvfrom).

Are you using the same socket from two different threads?  Most sockets
API (lwIP included) do not guarantee the behaviour you might be hoping
for: it's just like any other shared resource - you need to protect it
from concurrent access with mutexes.  The best course would be to
serialise your access to each socket through a single thread.

Kieran





reply via email to

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