lkml.org 
[lkml]   [2011]   [Aug]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 13/15] x86: add cmpxchg_flag() variant
On 08/23/2011 12:53 PM, Jeremy Fitzhardinge wrote:
>
> Yes, that would ideal. The closest you can get is asm goto(), but the
> syntax for that would be awful; something like:
>
> #define cmpxchg_jump(ptr, old, new, fail)\
> asm goto (...)
>
>
> :
> :
>
> again:
> old = *thingp;
> new = frobulate(old);
> cmpxchg_jump(thingp, old, new, again);
> /* worked */
>
> Would this be useful enough?
>

Actually there is a trick:

static inline bool ....
{
asm goto(... yes);
no:
return false;
yes:
return true;
}
... which makes syntax a heckuva lot less awkward.

-hpa


\
 
 \ /
  Last update: 2011-08-23 22:47    [from the cache]
©2003-2011 Jasper Spaans