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: Leon Woestenberg
Subject: Re: [lwip-users] Socket API thread safe?
Date: Wed, 09 Jun 2004 19:37:18 +0200
User-agent: Mozilla Thunderbird 0.5 (Windows/20040207)

Hello Peter et al,

address@hidden wrote:
Leon Woestenberg wrote:
This is a recurring topic (and rightly so).
lwIP socket API is *not* multi-threaded safe in the *generic* sense, i.e. for a full-pre-emptive environment (this is as far as I know).

So how do you know (given a proper implementation of sysarch and lightweight prot. of course)? Can you provide an example?

I do not know for certain, but lets take an example where I think it
goes wrong:

1 - network interface hardware receives packet, raises interrupt
2 - the lwIP netif device driver's foobar_input() funtion is called
    from a task that is made runnable, triggered by the interrupt.
3 - the packet happens to update the ARP table
4 - During 3, a higher priority task becomes runnable (and thus running)
and sends out a packet on its own private UDP socket.

We have a concurrent reader and writer in the ARP module and have
incorrect behaviour.

I have explicitly not mentioned a API here. I am just curious if this
case is covered. I am SURE the raw API is non-thread-safe, I just wish
to hear the netconn_ API is.

I see some minor restiction, e.g. error handling and no cross-thread usage of same socket, but in general I successfully run it in a _full_ preemptive environment.

I think it may work fine in most cases, but I doubt we have full mutual
exclusion of concurrent (possibly modifying) accesses to internal
housekeeping in lwIP.

Please let me know if I am wrong. I also would like to see this sorted out.

Regards,

Leon.




reply via email to

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