[Top][All Lists]

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

Re: [lwip-users] LwIP v2.1.2 in UDP client mode gets stuck in etharp_que

From: Lan Yang
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?
Date: Fri, 23 Sep 2022 15:36:14 +0800

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.


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.

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,


CONFIDENTIALITY NOTICE: The contents of this email and any attachments are intended solely for the addressee(s) and contain confidential and/or privileged information and are legally protected from disclosure unless otherwise indicated. If you received this message by mistake, please immediately alert the sender by reply email and then delete this message and any attachments. If you are not the intended recipient, you are hereby notified that any use, dissemination, copying, or storage of this message or its attachments is strictly prohibited.  

reply via email to

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