lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lwip-users] Re: lightweight protection


From: Marc Boucher
Subject: [lwip-users] Re: lightweight protection
Date: Thu, 20 Feb 2003 18:03:51 +0100
User-agent: Mutt/1.5.1i

Hi folks,

After some deeper reflection I feel that the current "lightweight protection"
approach in lwIP is not really the right way to go.

Instead of a global locking mechanism we should have more fine grained
locking primitives to protect specific things independently.
This way it would also be trivial if desired to map everything
to a single global protection based on semaphores or interrupt blocking,
but systems needing finer grained locking could have it too.
By default the primitives could be based on the portable mutex semaphores
(if not overridden with more optimized platform-specific versions)
which would be equivalent to the way things used to be done.

Also the practice of having protecting wrappers (like memp_mallocp()
and memp_freep()) just to call unprotected counterparts which are
called directly in other cases seems very dubious. Especially
since some rather long operations (like the memset() call in
memp_malloc()) end up being done unnecessarily under the "protected"
state, which is not only inefficient but can have bad side-effects on some
platforms, where for example lightweight protection is implemented by
disabling interrupts.

Locks should only be held or interrupts blocked during the least possible
time required to manipulate shared data and avoid races..

Regards
Marc




reply via email to

[Prev in Thread] Current Thread [Next in Thread]