|
From: | Darius Babrauskas |
Subject: | [lwip-users] UDP socket thread safe problem |
Date: | Thu, 23 Feb 2012 10:34:23 +0200 |
Hello,
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.
Each socket using lwip_select function for detect
receive data and timeouts. A thread using 1 second timeout, B using 10 seconds
timeout.
Problem:
A or B thread corrupting timeouts other
thread. If working one thread (or other sleeping) then all ok. But
if both tread using lwip_select, then timeouts begun work strange. Example.:
B timeout must be 10 second, but it triger after 1
second , then 5 times 10seconds, then 9 seconds or 14 seconds. A
timeouts receiving real data, but timeout begun sometimes 0-1ms. So,
data not received, because real must about after 60ms.
I found like post.
http://lists.gnu.org/archive/html/lwip-users/2009-01/msg00011.html
but no any answer.
"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.
|
[Prev in Thread] | Current Thread | [Next in Thread] |