]>
Commit | Line | Data |
---|---|---|
59e0d9fe A |
1 | .Dd May 26, 2004 |
2 | .Dt BARRIER 3 | |
3 | .Os Darwin | |
4 | .Sh NAME | |
5 | .Nm OSMemoryBarrier | |
6 | .Nd memory barrier to order loads and stores | |
7 | .Sh LIBRARY | |
8 | .Lb libc | |
9 | .Sh SYNOPSIS | |
10 | .In libkern/OSAtomic.h | |
11 | .Ft void | |
12 | .Fn OSMemoryBarrier "void" | |
13 | .Sh DESCRIPTION | |
14 | .Fn OSMemoryBarrier | |
15 | strictly orders memory accesses in a weakly ordered memory model such as with PowerPC, | |
16 | by creating a barrier. All loads and stores executed in sequential program order before | |
17 | the barrier will complete with respect to the memory coherence mechanism, before any | |
18 | load or store executed after the barrier. Used with an atomic operation, the barrier | |
19 | can be used to create custom synchronization protocols as an alternative to the | |
20 | spinlock or queue/dequeue operations. Note that this barrier does not order uncached loads | |
21 | and stores. On a uniprocessor, the barrier operation is typically optimized into a nop. | |
22 | .Sh SEE ALSO | |
23 | .Xr atomic 3 , | |
24 | .Xr atomicqueue 3 , | |
25 | .Xr spinlock 3 |