lwip-users
[Top][All Lists]
Advanced

[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.

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


  







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]