[lkml]   [2002]   [Jul]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    SubjectRe: spinlock assertion macros
    Oliver Xymoron wrote:
    > On Thu, 11 Jul 2002, Daniel Phillips wrote:
    > > I was thinking of something as simple as:
    > >
    > > #define spin_assert_locked(LOCK) BUG_ON(!spin_is_locked(LOCK))
    > >
    > > but in truth I'd be happy regardless of the internal implementation. A note
    > > on names: Linus likes to shout the names of his BUG macros. I've never been
    > > one for shouting, but it's not my kernel, and anyway, I'm happy he now likes
    > > asserts. I bet he'd like it more spelled like this though:
    > >
    > > MUST_HOLD(&lock);
    > I prefer that form too.

    Is it worth adding MUST_NOT_HOLD(&lock) in an attempt to catch potential

    Say that if two or more of locks A, B and C are to be taken, then
    they must be taken in that order. You might then have code like:

    MUST_NOT_HOLD(&lock_B) ;
    MUST_NOT_HOLD(&lock_C) ;
    spinlock(&lock_A) ;

    I think you need a separate asertion for this !MUST_NOT_HOLD(&lock)
    has different semantics.
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to
    More majordomo info at
    Please read the FAQ at

     \ /
      Last update: 2005-03-22 13:22    [W:0.031 / U:0.532 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site