BARRIER(3) BSD Library Functions Manual BARRIER(3)NAME
OSMemoryBarrier -- memory barrier to order loads and stores
LIBRARY
Standard C Library (libc, -lc)
SYNOPSIS
#include <libkern/OSAtomic.h>
void
OSMemoryBarrier(void);
DESCRIPTION
OSMemoryBarrier() strictly orders memory accesses in a weakly ordered memory model such as with PowerPC, by creating a barrier. All loads
and stores executed in sequential program order before the barrier will complete with respect to the memory coherence mechanism, before any
load or store executed after the barrier. Used with an atomic operation, the barrier can be used to create custom synchronization protocols
as an alternative to the spinlock or queue/dequeue operations. Note that this barrier does not order uncached loads and stores. On a
uniprocessor, the barrier operation is typically optimized into a nop.
SEE ALSO atomic(3), spinlock(3)Darwin May 26, 2004 Darwin
Check Out this Related Man Page
MEMBAR_OPS(3) BSD Library Functions Manual MEMBAR_OPS(3)NAME
membar_ops, membar_enter, membar_exit, membar_producer, membar_consumer, membar_sync -- memory access barrier operations
SYNOPSIS
#include <sys/atomic.h>
void
membar_enter(void);
void
membar_exit(void);
void
membar_producer(void);
void
membar_consumer(void);
void
membar_sync(void);
DESCRIPTION
The membar_ops family of functions provide memory access barrier operations necessary for synchronization in multiprocessor execution envi-
ronments that have relaxed load and store order.
membar_enter()
Any store preceding membar_enter() will reach global visibility before all loads and stores following it.
membar_enter() is typically used in code that implements locking primitives to ensure that a lock protects its data.
membar_exit()
All loads and stores preceding membar_exit() will reach global visibility before any store that follows it.
membar_exit() is typically used in code that implements locking primitives to ensure that a lock protects its data.
membar_producer()
All stores preceding the memory barrier will reach global visibility before any stores after the memory barrier reach global visibility.
membar_consumer()
All loads preceding the memory barrier will complete before any loads after the memory barrier complete.
membar_sync()
All loads and stores preceding the memory barrier will complete and reach global visibility before any loads and stores after the memory
barrier complete and reach global visibility.
SEE ALSO atomic_ops(3)HISTORY
The membar_ops functions first appeared in NetBSD 5.0.
BSD February 11, 2007 BSD
Hi all,
(Hope this is the right forum for this question)
I have some multi-threaded C code (compiled with GCC 4.4.3) which accesses shared variables. Although I've marked those variables with volatile to guard against compiler re-ordering, I'm concerned that processor out-of-order execution... (19 Replies)
Hello,
we got a MD3000i used as a network share between two servers (say A and B). The problem we are facing is that file/directories created by server A are not visible on server B (and viceversa). It's not a problem with permission (chmod 777 doesn't help).
The MD3000i was at first used ony... (0 Replies)
From the site:
Austrian sky diver Felix Baumgartner and the Red Bull Stratos team will attempt to break the human free-fall record. If successful, Baumgartner will break four world records: highest manned balloon flight, free fall from the highest altitude, supersonic speed in free fall and... (1 Reply)