On 11/02/2011 11:22 AM, Richard Henderson wrote:
On 11/02/2011 07:59 AM, Andrew MacLeod wrote:
Simply adds an optional parameter to __atomic_{is_always}_lock_free
which is used to check alignment against the size parameter. NULL as
the object pointer produces the same behaviour as today, lockfreeness
based on proper alignment for an integral value of the specified size.
Why a pointer to the object? Are you really going to check the real
object alignment in the library __atomic_lock_free?
Seems to me that another integer argument does just as well:
__atomic_is_always_lock_free (sizeof(T), __alignof(T))
Well that could be an option. I'm just thinking about how the C1x call
works. its 'is_lock_free (object *)' (which is more or less what
c++ is as well.)
The standards are very specific that it is individual object specific,
and that objects of the same size may not share the lock free property.
I was thinking of when someone uses a slice of memory that is say 4
bytes. 1 in 4 of those are aligned properly at runtime :-) The library
can simply check the address passed into it an say, yeah, thats aligned,
use the lock-free routine.
Im guessing thats their intent, it seems reasonable...
if you are passing a second value in, alignof(T) is more limiting than
an actual object pointer, so I figure just let the library decide what
to do with it..
Andrew