Hello Jan, On Thu, Jun 04, 2015 at 02:34:39PM +0200, Jan Menzel wrote: > Hi Noam! > From earlier discussion on this list, I learned that for this purpose > one may schedule a callback into the LWIPs internal task using > tcpip_callback() or tcpip_callback_with_blocking(). Both queue your > function and its arguments for execution from within the main Lwip task > context. I'm not sure if this is applicable here, but if so, I would > favour the callback solution as yours might introduce dead locks in case > tcp_sndbuf() blocks. This type of errors are comparably difficult to > find and likely to happen if eg. an other task is used to free buffers > after transmission completed.
You are right. For future readers which might looks at this thread in the hope of getting a clue, please don't get fooled !, what Noam is doing is completely wrong. Adding a critical section and playing with thread priority this way is either dangerous or just stupid. (And don't tell me that it is working, I don't care if it -appears- to work). OS users HAVE TO use the Netconn or Socket API if they want to call lwIP functions from others threads, period. RAW API is ***NOT*** thread-safe. I repeat, RAW API is ***NOT*** thread-safe. Sylvain
signature.asc
Description: Digital signature
_______________________________________________ lwip-users mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/lwip-users
