I recall hashing this about previously; again I believe it is required when the OS does not provide a semaphore mechanism to assure the pbuf pool does not get corrupted. Whether a multi-threaded or single-threaded implementation, if the ethif interrupt routine is allocating and moving received packets using pbufs, there has to be a way to prevent that from happening in the middle of a critical section of the stack's code. THIS is why SYS_LIGHTWEIGHT_PROT exists and is needed.
Read the comments in sys.h for more background... And someone correct me if I'm wrong, but I think this was Adam's original protection scheme and not something 'some programmer' added. I am using it and must also vote to retain this code. - Jim -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Peter Graf Sent: Sunday, November 12, 2006 5:25 AM To: Mailing list for lwIP users Subject: Re: [lwip-users] Bug in pbuf.c regarding PBUF_POOL Leon Woestenberg wrote: >> Thanks for the detailed post - good to see folks getting to grips >> with the stack. The above seemed to summarise quite nicely and I >> agree completely with that. >> > I completely agree with you; It's good to see there is interest in the > lwIP stack from developers that are concerned abouts its correctness. > > The SYS_LIGHTWEIGHT_PROT protection was introduced by one of the > developers using the stack to protect *ONLY* between interrupt context > and single-thread user-space context if I am not mistaken. I think you are mistaken. > I am all for removing it, because the locking solution does not scale > across different platforms. I have to use SYS_LIGHTWEIGHT_PROT in a _multithreaded_ environment with interrupt-triggered device driver. Removing it would render lwIP unusable for me. I guess it lies in the nature of a simple locking mechanism to be platform specific, but that makes it "lightweight". I vote against a removal. All the best Peter _______________________________________________ lwip-users mailing list [email protected] http://lists.nongnu.org/mailman/listinfo/lwip-users _______________________________________________ lwip-users mailing list [email protected] http://lists.nongnu.org/mailman/listinfo/lwip-users
