Dear Sylvain, All my modules are RAW API including the WEB server.
Using critical section in pin point location is not wrong. Any other implementation will Have to use a more complicated queuing mechanism. Complicated, maybe. Slower, maybe but not stupid, sorry :-) BR, Noam. -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Sylvain Rochet Sent: Thursday, June 04, 2015 3:45 PM To: Mailing list for lwIP users Subject: Re: [lwip-users] memory leak ? 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 ************************************************************************************ This footnote confirms that this email message has been scanned by PineApp Mail-SeCure for the presence of malicious code, vandals & computer viruses. ************************************************************************************ ************************************************************************************ This footnote confirms that this email message has been scanned by PineApp Mail-SeCure for the presence of malicious code, vandals & computer viruses. ************************************************************************************ _______________________________________________ lwip-users mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/lwip-users
