Re: [(RT RFC) PATCH v2 5/9] adaptive real-time lock support

From: Gregory Haskins
Date: Tue Feb 26 2008 - 13:08:59 EST


>>> On Tue, Feb 26, 2008 at 1:06 PM, in message
<20080226180643.GA6030@xxxxxxxxxx>, Pavel Machek <pavel@xxxxxx> wrote:
> On Tue 2008-02-26 08:03:43, Gregory Haskins wrote:
>> >>> On Mon, Feb 25, 2008 at 5:03 PM, in message
>> <20080225220313.GG2659@xxxxxxxxxx>, Pavel Machek <pavel@xxxxxx> wrote:
>>
>> >> +static inline void
>> >> +prepare_adaptive_wait(struct rt_mutex *lock, struct adaptive_waiter
>> > *adaptive)
>> > ...
>> >> +#define prepare_adaptive_wait(lock, busy) {}
>> >
>> > This is evil. Use empty inline function instead (same for the other
>> > function, there you can maybe get away with it).
>> >
>>
>> I went to implement your suggested change and I remembered why I did it this
> way: I wanted a macro so that the "struct adaptive_waiter" local variable
> will fall away without an #ifdef in the main body of code. So I have left
> this logic alone for now.
>
> Hmm, but inline function will allow dead code elimination, too, no?

I was getting compile errors. Might be operator-error ;)

>
> Anyway non-evil way to do it with macro is
>
> #define prepare_adaptive_wait(lock, busy) do {} while (0)
>
> ...that behaves properly in complex statements.

Ah, I was wondering why people use that. Will do. Thanks!

-Greg

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/