[ntp:hackers] [Gpsd-dev] Single-writer/many-reader consistency
f96hajo at chalmers.se
Sat Mar 26 16:04:48 UTC 2011
> I've done some research, it turns out that both gcc (from v4.something)
> and MS Visual C (from before V2005) have builtin support for memory
> In the latter there's a nice chart showing all the ways various
> architectures relaxes the strict program order memory consistency.
> Quoting the second link above:
> GCC since version 4.1.0 and intel c++ compiler have special builtin for
> calling full hardware memory barrier:
htj at org-pc51:~/sw$ gcc --version
gcc (Debian 4.3.2-1.1) 4.3.2
Copyright (C) 2008 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
htj at org-pc51:~/sw$ gcc -O3 -o sync.o -c sync.c
htj at org-pc51:~/sw$ objdump -d sync.o
sync.o: file format elf64-x86-64
Disassembly of section .text:
0: c3 retq
No memory barriers... (-O3 had no difference, just made it shorter)
third answer 'Dec 5 '09 at 10:47'
"Note not implemented on all platforms and silently does nothing when not
implemented. Found this out the hard way on ARM..."
More information about the hackers