On Wed, Jul 22, 2015 at 02:51:44AM +0000, Chris Lesiak wrote: > Instead of using __sync_synchronize, would you consider requiring > --std=c11 so that stdatomic.h can be used?
<stdatomic.h> support is not available before gcc 4.9. Our compiler support extends back to gcc 4.4 on Ubuntu 10.04. https://gcc.gnu.org/wiki/C11Status http://wiki.linuxcnc.org/cgi-bin/wiki.pl?MinimumSoftwareVersions gcc 4.4 does support a suite of built-in functions for atomic memory access https://gcc.gnu.org/onlinedocs/gcc-4.4.7/gcc/Atomic-Builtins.html My plan was simply to #define rtapi_barrier() __sync_synchronize() as the simplest (but not most performant, as you point out) thing possible, particularly for the approaching 2.7 release. It sounds like you have more familiarity with these issues than me. Would you like to be involved in planning and implementing something better (more performant and more aligned with the C11 standard, but compatible with gcc 4.4) for the master branch of LinuxCNC? In general outline, this would involve selecting a subset of <stdatomic.h> to support in LinuxCNC and implementing it in a header <rtapi_stdatomic.h>. When compiler support is available, this can be done by delegating to the built-in header. #ifndef RTAPI_STDATOMIC_H #define RTAPI_STDATOMIC_H #if (compiler provides usable stdatomic.h) #include <stdatomic.h> #else /* implementation of stdatomic subset * in terms of gcc 4.4 primitives such as __sync_synchronize */ enum memory_order { ... }; #define load_atomic... #define store_atomic... #endif #endif along with a manual page which documents the subset of <stdatomic.h> that is supported by <rtapi_stdatomic.h>, plus any (rtapi-prefixed) extensions--for instance if we provide rtapi_barrier() as a public API in 2.7 we need to continue to provide it for at least one release in which it is marked as "deprecated". Jeff ------------------------------------------------------------------------------ _______________________________________________ Emc-developers mailing list Emc-developers@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-developers