[riot-notifications] [RIOT-OS/RIOT] sys: Added simple memory barrier API (#11438)

Marian Buschsieweke notifications at github.com
Thu Apr 25 14:13:14 CEST 2019

> - memory_barrier() is not adding anything special on top of __sync_synchronize().

That is true, but it allows future modification. (E.g. assume a specific toolchain has a broken `__sync_synchronize()`,  we could simple use inline assembly to work around that issue. And for in-order platforms with no support for `__sync_synchronize()` we could just define `memory_barrier()` to use `compiler_barrier()`.)

Also, I personally think `memory_barrier()` is a descriptive name, while `__sync_synchronize()` is not. 

I'd also prefer `compiler_barrier()` over `barrier()`, as the name `compiler_barrier()` makes it obvious that CPU reordering is not prevented.

> - I'd rather go with the proven, traditional definition using a macro.


> - __sync_synchronize() should be defined ONLY on those architectures that don't have the builtin (in the cpu and not in core)

I agree, but I'd think that should be a separate PR.

You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190425/b17742ed/attachment-0001.html>

More information about the notifications mailing list