Thread (36 messages) 36 messages, 5 authors, 2008-03-03

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

From: Pavel Machek <hidden>
Date: 2008-02-26 18:06:26
Also in: lkml

On Tue 2008-02-26 08:03:43, Gregory Haskins wrote:
quoted
quoted
quoted
On Mon, Feb 25, 2008 at  5:03 PM, in message
[ref], Pavel Machek [off-list ref] wrote: 
quoted
quoted
+static inline void
+prepare_adaptive_wait(struct rt_mutex *lock, struct adaptive_waiter 
*adaptive)
...
quoted
+#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?

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.
									Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help