lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] lwip-users Digest, Vol 229, Issue 12


From: Peter
Subject: Re: [lwip-users] lwip-users Digest, Vol 229, Issue 12
Date: Fri, 23 Sep 2022 11:04:55 +0100

I have been told by an "expert" that the RAW API is *never* thread
safe.

The core locking feature is just a more timing-efficient way of doing
things, but the LWIP netconn and sockets APIs are thread-safe anyway.



>Send lwip-users mailing list submissions to
>       lwip-users@nongnu.org
>
>To subscribe or unsubscribe via the World Wide Web, visit
>       https://lists.nongnu.org/mailman/listinfo/lwip-users
>or, via email, send a message with subject or body 'help' to
>       lwip-users-request@nongnu.org
>
>You can reach the person managing the list at
>       lwip-users-owner@nongnu.org
>
>When replying, please edit your Subject line so it is more specific
>than "Re: Contents of lwip-users digest..."
>
>
>Today's Topics:
>
>   1. Re: LwIP v2.1.2 in UDP client mode gets stuck in
>      etharp_query() after running for a long time without connection?
>      (Lan Yang)
>   2. Re: why is my stack usage so high for the tx thread hosted by
>      lwip? (Bas Prins)
>
>
>----------------------------------------------------------------------
>
>Message: 1
>Date: Fri, 23 Sep 2022 15:36:14 +0800
>From: Lan Yang <lanyang@autox.ai>
>To: lwip-users@nongnu.org, goldsimon@gmx.de
>Subject: Re: [lwip-users] LwIP v2.1.2 in UDP client mode gets stuck in
>       etharp_query() after running for a long time without connection?
>Message-ID:
>       <CALxRPyvfbTbkybxfVe4uX9KVY5QV9H=cOwz4Owtd4OKqrXAcsA@mail.gmail.com>
>Content-Type: text/plain; charset="utf-8"
>
>On Fri, Sep 23, 2022 at 12:22 AM <goldsimon@gmx.de> Simon Goldschmidt wrote:
>
>> Looks like yet another threading issue. Or in other words, it seems like
>> you are using lwip in a wrong way, resulting in Rx processing, tx
>> processing and possibly timer processing being active in the code at the
>> same time.
>>
>> Regards,
>> Simon
>>
>
>Hi Simon,
>
>Thank you! Your reply has given me more confidence in my test results.
>After a lot of tests, I find it stuck because I use an un-thread safe
>function "udp_send()" outside the tcpip_thread.
>
>I read a lot of the lwip-user archives. They help me a lot.
>https://lists.gnu.org/archive/html/lwip-users/2009-05/msg00049.html
>https://lists.gnu.org/archive/html/lwip-users/2022-07/msg00012.html
>https://lists.gnu.org/archive/html/lwip-users/2010-04/msg00053.html
>
>
>And now I found two ways to resolve the problem.
>I would like to ask for your advice about which way is more recommended.
>
>The first method:
>Just use LOCK_TCPIP_CORE() and UNLOCK_TCPIP_CORE() to protect the other
>threads which need to call the LwIP's raw api (such as udp_send()).
>
>The second method:
>use the tcpip_try_callback() function in the other threads(outside the
>tcpip_thread) to post message to tcpip_thread, and when the tcpip_thread
>handle its message, it will call the according callback function, and then
>I can call the LwIP's raw api (such as udp_send()) in the callback function
>which is called by the tcpip_thread.
>
>Both methods have passed my test. They all work well.
>Which method is more recommended?
>
>Best regards,
>Lan



reply via email to

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