"conn->callback is called from api_msg.c in the core-receive-callbacks (recv_raw/recv_udp/recv_tcp) but also from netconn_recv, when data was received by the
application. This is definitively not thread-safe. "
I understud that it old version. Porting last lwip version - possible more problems.
So. What advise? (maybe need use in one thread raw udp function ? )
P.S. Thread C using tcp socket with select function, but it working ok.
lwIP 1.2.0 is very old and *is known* to have threading problems. Please upgrade to the latest version.
Simon
--
Empfehlen Sie GMX DSL Ihren Freunden und Bekannten und wir
belohnen Sie mit bis zu 50,- Euro! https://freundschaftswerbung.gmx.de
_______________________________________________
lwip-users mailing list
lwip-...@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users
> I have old project with LWIP v.1.2. for AVR32.
>
> Problem:
>
> 2 threads A and B . Each treads have 1 UDP socket with No( 0 and 1 ). Each thread have self timeout struct.
I think if you don't want to update to the latest version of lwIP you will probably have to serialise your use of lwIP sockets into a single thread.
Kieran
Currently I replace udp socket in one thread with RAW api functions. Now
select function in other thread working ok. But tread with RAW udp
connection work not good. Because I get first respond in call_back function
after 10s. (because send IP not in arp table and send function packet is
queueing)
LWIP options
#define SYS_LIGHTWEIGHT_PROT 1
#define ARP_QUEUEING 1
Maybe need manualy refresh arp request quene?
That bug doesn't exist in 1.4.0. It even doesn't really exist in 1.2.0: the actual bug is that the netif driver passes incoming packets into the ARP module from its input context instead of getting into tcpip_thread first (this was however a bug in the example ethernetif.c, so many people copied it).
> To resolve this problem, posible need use semaphores to protect arp table.
No, the complete stack (all modules including UDP, IP, ARP and others) need to be accessed from one thread at a time only. While this is fixed in 1.4.0 by letting the tcpip_thread check if input packets need to be passed to ARP (the netif driver just calls netif->input(p) for all packets), you can implement this in your 1.2.0 driver by calling tcpip_callback() to get the ARP input packets into tcpip_thread.
Upgrading to 1.4.0 (or 1.4.1 RC1) is of course the cleaner solution - 1.2.0 is really old and includes many other bugs that are fixed by now.
Simon
--
NEU: FreePhone 3-fach-Flat mit kostenlosem Smartphone!
Jetzt informieren: http://mobile.1und1.de/?ac=OM.PW.PW003K20328T7073a
No, both your lwIP port and your application have to ensure you are not using lwIP from more than one contexs at the same time (where context means thread or ISR). How you do this is up to you: you can use a mutex or process RX packets and timers from the same main loop that eventually calls udp_output().
Thread-safety is not something which is provided by lwIP itself: the developer creating the port or application is free to chose which type of concurrency protection he wants to use.
Simon
--
Empfehlen Sie GMX DSL Ihren Freunden und Bekannten und wir
belohnen Sie mit bis zu 50,- Euro! https://freundschaftswerbung.gmx.de
_______________________________________________
Darius
----- Original Message -----
From: "Simon Goldschmidt" <gold...@gmx.de>
To: "Mailing list for lwIP users" <lwip-...@nongnu.org>