On Fri, May 08, 2020 at 01:51:16AM +0200, Kamil Rytarowski wrote: > A runtime detection could be a part of ifunc (is it ready for NetBSD?). > > The standard C/C++ feature is to detect whether atomic operations are > real (lock-free) through atomic_is_lock_free(). This is a feature, not a > bug (as claimed by some people). atomic_is_lock_free() can be overloaded > in libatomic and detect CPU type in runtime and redirect either to real > CPU intrinsic of lock-free fallback.
Not without performance penalty for every atomic operation, unless you propose to do this by binary patch as is done in the kernel. Thor