On 07/22/2015 11:30 AM, Jeff Epler wrote:
> 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?
I would like to provide some help but cannot commit to anything at
this time.
> 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".
>
I think this does look like a good plan, given the constraints.
It may be worth the effort to define and use the atomic_explicit
versions so that you can document the actual memory order requirements,
even if for the time being they implement a full memory barrier.
It will take some mental effort to determine exactly what the memory
order requirements are at a particular use, but maybe only twice as much
as identifying that some requirement exists.
--
Chris Lesiak
Principal Design Engineer, Software
LI-COR, Inc.
[email protected]
Any opinions expressed are those of the author and
do not necessarily represent those of his employer.
------------------------------------------------------------------------------
_______________________________________________
Emc-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/emc-developers