|
From: | Matias Mandell |
Subject: | [lwip-users] The sockets interface, select() |
Date: | Mon, 19 Sep 2011 10:31:59 +0300 |
User-agent: | Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:7.0) Gecko/20110905 Thunderbird/7.0 |
Hi!When I upgraded from LwIP 1.3.2 to 1.4.0 I had to make some changes in the port, as a tip for others:
http://lwip.wikia.com/wiki/Porting_for_an_OS_1.4.0 http://lwip.wikia.com/wiki/Writing_a_device_driverHowever, it was crashing and the real cause of the problem could not be found easily with the embedded debugger. I went thru my port several times and added all sorts of checks. After a while I found out that the problem seemed to be related to the sockets interface.
In the end of event_callback() when it has gone thru all tasks waiting for a select() it unprotects&protects and starts over from the beginning. At this point the sock->select_waiting was sometimes zero and the loop crashed.
In lwip_select() there are protections when adding/removing from list and increasing/decreasing sock->select_waiting counters but they are not in sync. How good idea is it to pass a local variable to another task, there might be context switching in between? I might have a stack overflow or something going on...
Sincerely, Matias -- mat!as
[Prev in Thread] | Current Thread | [Next in Thread] |