mirror of
https://git.savannah.nongnu.org/git/lwip.git
synced 2026-05-20 07:06:53 +08:00
fixed bug #21433 (Calling mem_free/pbuf_free from interrupt context isn't safe): set LWIP_USE_HEAP_FROM_INTERRUPT to 1 in lwipopts.h or use tcpip_callback_nonblocking(pbuf_free_int, p)/ tcpip_callback_nonblocking(mem_free, m) to free pbufs or heap memory from interrupt context
This commit is contained in:
@@ -155,6 +155,23 @@
|
||||
#define MEMP_USE_CUSTOM_POOLS 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* This is for NO_SYS=0 only; in NO_SYS=1 configurations, the heap may not be accessed
|
||||
* from interrupt level!
|
||||
*
|
||||
* If you want to free PBUF_RAM pbufs (or call mem_free()) from interrupt context,
|
||||
* the heap cannot be protected by a semaphore. Setting this to 1 will disable
|
||||
* interrupts while walking the heap.
|
||||
*
|
||||
* *** USE THIS WITH CARE: Setting this to 1 can disable interrupts for a long time! ***
|
||||
*
|
||||
* If you don't want that, call
|
||||
* - tcpip_callback_nonblocking(pbuf_free_int, p);
|
||||
* - tcpip_callback_nonblocking(mem_free, m);
|
||||
*/
|
||||
#ifndef LWIP_USE_HEAP_FROM_INTERRUPT
|
||||
#define LWIP_USE_HEAP_FROM_INTERRUPT 0
|
||||
#endif
|
||||
|
||||
/*
|
||||
------------------------------------------------
|
||||
|
||||
@@ -83,7 +83,10 @@ err_t tcpip_netifapi_lock(struct netifapi_msg *netifapimsg);
|
||||
#endif /* LWIP_NETIF_API */
|
||||
|
||||
err_t tcpip_callback_with_block(void (*f)(void *ctx), void *ctx, u8_t block);
|
||||
#define tcpip_callback(f,ctx) tcpip_callback_with_block(f,ctx,1)
|
||||
#define tcpip_callback(f, ctx) tcpip_callback_with_block(f, ctx, 1)
|
||||
#define tcpip_callback_nonblocking(f, ctx) tcpip_callback_with_block(f, ctx, 0)
|
||||
|
||||
void pbuf_free_int(struct pbuf *p);
|
||||
|
||||
err_t tcpip_timeout(u32_t msecs, sys_timeout_handler h, void *arg);
|
||||
#define tcpip_untimeout(h, arg) tcpip_timeout(0xffffffff, h, arg)
|
||||
|
||||
Reference in New Issue
Block a user