[fpc-devel] Why FreeBSD sem_init() works different to Linux?
Henry Vermaak
henry.vermaak at gmail.com
Thu Feb 7 15:43:11 CET 2013
On Thu, Feb 07, 2013 at 03:11:00PM +0100, Jonas Maebe wrote:
> The interlocked* routines only guarantee that that particular value
> is updated in atomic way across multiple cores. It does not
> guarantee anything about memory access performed before or after
> that interlocked* call. The memory barriers are to ensure that all
> memory accesses before the lock-primitive (such as Enter/
> LeaveCriticalSection) are also synchronized across all cores.
It may be a good idea for the documentation to explicitly say which
functions do/do not imply memory barriers, since the linux kernel
atomic_cmpxchg() and the Windows API guarantees full memory barriers, so
people may expect that.
Henry
More information about the fpc-devel
mailing list