|
From: | address@hidden |
Subject: | Re: [lwip-users] Reentrency problem within mem.c module |
Date: | Thu, 25 Oct 2007 17:55:21 +0200 |
User-agent: | Thunderbird 2.0.0.6 (Windows/20070728) |
Jonathan Larmour schrieb:
That's the problem: you can't simply call pbuf_free directly because you could be sending a packet at non-interrupt level while trying to free a pbuf at TX interrupt level!I think doing a tcpip_callback() call (or something similar), so the tcpip thread handles it, would be smaller and simpler. (Of course for NO_SYS==1, you can just call pbuf_free directly since there should only be one context in lwIP as it is).
For NO_SYS==0, I favour your tcpip_callback since the interrupt function doesn't need to walk the heap and thus is faster. But I would favour a solution that solves this problem for both NO_SYS settings...
pbuf_free_safe() would be enough in this situation, but since memp_free is the problem (no pbuf_free()),Perhaps pbuf_free() is a sufficiently common operation for this sort of thing, that we could make a new pbuf_free_safe() call or something, which either calls pbuf_free() (NO_SYS==1) or tcpip_callback to call pbuf_free (NO_SYS==0).
I think memp_free_safe() would be better since it is more generic. Simon
[Prev in Thread] | Current Thread | [Next in Thread] |