[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lwip-users] Re: lightweight protection
From: |
Marc Boucher |
Subject: |
Re: [lwip-users] Re: lightweight protection |
Date: |
Thu, 20 Feb 2003 19:23:02 +0100 |
User-agent: |
Mutt/1.5.1i |
On Thu, Feb 20, 2003 at 05:24:51PM +0000, Kieran Mansley wrote:
> On Thu, 20 Feb 2003, Marc Boucher wrote:
> > Locks should only be held or interrupts blocked during the least possible
> > time required to manipulate shared data and avoid races..
>
> In general, yes, but there is a trade off with the overhead it takes to
> acquire or free a lock. ie. If you are continually taking and releasing
> locks in a tight loop to avoid holding the lock over a piece of code that
> doesn't require it, you will find you're spending all of your time on the
> locking.
>
> Kieran
Yes, of course. Locks should be used with good judgment.
My point was that encapsulating whole functions that are also entered
without the lock or call memset() to zero newly allocated private memory
outside of loops as it is done in the current CVS code is not proper.
Marc