public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* C++17 is_always_lock_free implementation
@ 2016-03-11 17:21 JF Bastien
  0 siblings, 0 replies; only message in thread
From: JF Bastien @ 2016-03-11 17:21 UTC (permalink / raw)
  To: gcc

Hello GCC / libstdc++ folks,

I implemented C++17's is_always_lock_free [0] in clang / libc++
and am wondering if GCC and libstdc++ are interested in following
a similar API as the one I propose in the clang patch [1].

What I propose is:

  * Extend the __GCC_ATOMIC_##TYPE##_LOCK_FREE macros to FLOAT,
    DOUBLE, LDOUBLE. This doesn't add corresponding C macros.

  * Add a __LLVM_LOCK_FREE_IS_SIZE_BASED macro with value 1 if
    all the lock-free-ness is based purely on the type's
    size. For LLVM this is currently the case for all ISAs.

  * Add macros __LLVM_ATOMIC_##BYTES##_BYTES_LOCK_FREE for sizes
    1, 2, 4, 8, 16. We could go further, but I don't think any
    ISA has 32-byte and up lock-free (and the C++ library can
    just #if defined() on wider types).

I then use these in libc++ [2].

It may be worth standardizing equivalent macros in C, but we'll
need these built-in macros anyways. I also think C macros aren't
as useful as the C++ template-based constexpr magic.

Thanks,

JF

  [0]: http://jfbastien.github.io/papers/P0152R1.html
  [1]: http://reviews.llvm.org/D17950
  [2]: http://reviews.llvm.org/D17951

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2016-03-11 17:21 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-11 17:21 C++17 is_always_lock_free implementation JF Bastien

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).