diff options
| author | Jason Toffaletti <jason@topsy.com> | 2013-10-07 00:43:34 -0700 |
|---|---|---|
| committer | Brian Anderson <banderson@mozilla.com> | 2013-10-25 18:27:45 -0700 |
| commit | c372fa55560f1cdfdcb566f3027689ba88c46da5 (patch) | |
| tree | 39e314bf05982a53ad8e19b84f084bb3f50d4e47 /src/libstd/rt/mpmc_bounded_queue.rs | |
| parent | 5876e21225f0cf34e8caa40b18db56fa716e8c92 (diff) | |
| download | rust-c372fa55560f1cdfdcb566f3027689ba88c46da5.tar.gz rust-c372fa55560f1cdfdcb566f3027689ba88c46da5.zip | |
add padding to prevent false sharing
Diffstat (limited to 'src/libstd/rt/mpmc_bounded_queue.rs')
| -rw-r--r-- | src/libstd/rt/mpmc_bounded_queue.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/libstd/rt/mpmc_bounded_queue.rs b/src/libstd/rt/mpmc_bounded_queue.rs index 8e6ac8f79c7..c0c7d281136 100644 --- a/src/libstd/rt/mpmc_bounded_queue.rs +++ b/src/libstd/rt/mpmc_bounded_queue.rs @@ -40,10 +40,14 @@ struct Node<T> { } struct State<T> { + pad0: [u8, ..64], buffer: ~[Node<T>], mask: uint, + pad1: [u8, ..64], enqueue_pos: AtomicUint, + pad2: [u8, ..64], dequeue_pos: AtomicUint, + pad3: [u8, ..64], } struct Queue<T> { @@ -62,10 +66,14 @@ impl<T: Send> State<T> { Node{sequence:AtomicUint::new(i),value:None} }; State{ + pad0: [0, ..64], buffer: buffer, mask: capacity-1, + pad1: [0, ..64], enqueue_pos: AtomicUint::new(0), + pad2: [0, ..64], dequeue_pos: AtomicUint::new(0), + pad3: [0, ..64], } } |
