[RFC][BZ #13690] Always read private before lll_unlock.

Mike Frysinger vapier@gentoo.org
Fri Dec 6 21:52:00 GMT 2013


On Friday 06 December 2013 14:43:05 Ondřej Bílka wrote:
> --- /dev/null
> +++ b/include/futex_unlock.h

probably should live at nptl/lowlevellock_unlock

> @@ -0,0 +1,15 @@
> +#define lll_unlock(lock, private) \

all new files need a proper comment header block

> +  ((void)) ({								      \
> +    int __private = private;						      \
> +    __lll_unlock (lock, __private);					      \
> +  })
> +
> +#define lll_unlock(lock, private) \

did i misread, or are both of these macros named "lll_unlock" ?  should one 
have a __ prefix ?

> +  ((void) ({								      \
> +    int *__futex = &(lock);						      \
> +    int __val = atomic_exchange_rel (__futex, 0);			      \
> +    if (__builtin_expect (__val > 1, 0))				      \
> +      lll_futex_wake (__futex, 1, private);				      \
> +  }))
> +
> +

no trailing newlines please
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20131206/f96ce72a/attachment.sig>


More information about the Libc-alpha mailing list