lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] The sockets interface, select()


From: Matias Mandell
Subject: Re: [lwip-users] The sockets interface, select()
Date: Tue, 20 Sep 2011 16:58:18 +0300
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:7.0) Gecko/20110905 Thunderbird/7.0

On 9/20/11 4:24 PM, Kieran Mansley wrote:
On Mon, 2011-09-19 at 10:31 +0300, Matias Mandell wrote:

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...
Without looking at the code I'm not quite sure what the problem is.  Do
you have a patch to fix it as that would show clearly what you're
describing.

In short, the lwip_select()-function's local variable
    struct lwip_select_cb select_cb;
is also used within the event_callback()-function.

I do not get a crash if I:
- exit the event_callback()-loop upon "sock->select_waiting==0", see attached excerpt.
or
- create static memory for the select_cb:s.


There is not a stack overflow, but I'm not sure how the stack is saved/loaded upon context switching. I am also experiencing problems opening new sockets after closing old ones, I have not looked at it but there seems to be another email discussion about it.


Sincerely, Matias

--
mat!as

Attachment: sockets.c
Description: Text document


reply via email to

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