In the LWIP RTOS example, the ethernetif.c file has low_level_input run in one thread and ethernetif_input run in another. This is fine for the example, but if you wish to do anything more complex, the do loop in ethernetif_input can read half-written pbufs.
I've found removing the do loop from ethernetif_input so that it is only executed once per queued message appears to resolve this. Not sure if that is the correct solution, maybe a mutex is needed?
I've had similar issues with the non-RTOS examples when pushing more than a basic echo. I haven't dug into the cause there, but I assume an interrupt half-way through the ethernetif_input loop to run low_level_input will do it?
In the LWIP RTOS example, the
ethernetif.cfile haslow_level_inputrun in one thread andethernetif_inputrun in another. This is fine for the example, but if you wish to do anything more complex, thedoloop inethernetif_inputcan read half-written pbufs.I've found removing the
doloop fromethernetif_inputso that it is only executed once per queued message appears to resolve this. Not sure if that is the correct solution, maybe a mutex is needed?I've had similar issues with the non-RTOS examples when pushing more than a basic echo. I haven't dug into the cause there, but I assume an interrupt half-way through the
ethernetif_inputloop to runlow_level_inputwill do it?