@@ -23,40 +23,46 @@ use cast;
2323use option:: { Option , Some , None } ;
2424use libc:: c_void;
2525use ops:: Drop ;
26+ use util:: NonCopyable ;
2627
2728/**
2829 * A simple atomic flag, that can be set and cleared. The most basic atomic type.
2930 */
3031pub struct AtomicFlag {
31- priv v: int
32+ priv v: int ,
33+ priv nocopy : NonCopyable
3234}
3335
3436/**
3537 * An atomic boolean type.
3638 */
3739pub struct AtomicBool {
38- priv v: uint
40+ priv v: uint ,
41+ priv nocopy : NonCopyable
3942}
4043
4144/**
4245 * A signed atomic integer type, supporting basic atomic arithmetic operations
4346 */
4447pub struct AtomicInt {
45- priv v: int
48+ priv v: int ,
49+ priv nocopy : NonCopyable
4650}
4751
4852/**
4953 * An unsigned atomic integer type, supporting basic atomic arithmetic operations
5054 */
5155pub struct AtomicUint {
52- priv v: uint
56+ priv v: uint ,
57+ priv nocopy : NonCopyable
5358}
5459
5560/**
5661 * An unsafe atomic pointer. Only supports basic atomic operations
5762 */
5863pub struct AtomicPtr < T > {
59- priv p: * mut T
64+ priv p: * mut T ,
65+ priv nocopy : NonCopyable
6066}
6167
6268/**
@@ -75,15 +81,15 @@ pub enum Ordering {
7581 SeqCst
7682}
7783
78- pub static INIT_ATOMIC_FLAG : AtomicFlag = AtomicFlag { v : 0 } ;
79- pub static INIT_ATOMIC_BOOL : AtomicBool = AtomicBool { v : 0 } ;
80- pub static INIT_ATOMIC_INT : AtomicInt = AtomicInt { v : 0 } ;
81- pub static INIT_ATOMIC_UINT : AtomicUint = AtomicUint { v : 0 } ;
84+ pub static INIT_ATOMIC_FLAG : AtomicFlag = AtomicFlag { v : 0 , nocopy : NonCopyable } ;
85+ pub static INIT_ATOMIC_BOOL : AtomicBool = AtomicBool { v : 0 , nocopy : NonCopyable } ;
86+ pub static INIT_ATOMIC_INT : AtomicInt = AtomicInt { v : 0 , nocopy : NonCopyable } ;
87+ pub static INIT_ATOMIC_UINT : AtomicUint = AtomicUint { v : 0 , nocopy : NonCopyable } ;
8288
8389impl AtomicFlag {
8490
8591 pub fn new ( ) -> AtomicFlag {
86- AtomicFlag { v : 0 }
92+ AtomicFlag { v : 0 , nocopy : NonCopyable }
8793 }
8894
8995 /**
@@ -106,7 +112,7 @@ impl AtomicFlag {
106112
107113impl AtomicBool {
108114 pub fn new ( v : bool ) -> AtomicBool {
109- AtomicBool { v : if v { 1 } else { 0 } }
115+ AtomicBool { v : if v { 1 } else { 0 } , nocopy : NonCopyable }
110116 }
111117
112118 #[ inline]
@@ -171,7 +177,7 @@ impl AtomicBool {
171177
172178impl AtomicInt {
173179 pub fn new ( v : int ) -> AtomicInt {
174- AtomicInt { v : v }
180+ AtomicInt { v : v, nocopy : NonCopyable }
175181 }
176182
177183 #[ inline]
@@ -209,7 +215,7 @@ impl AtomicInt {
209215
210216impl AtomicUint {
211217 pub fn new ( v : uint ) -> AtomicUint {
212- AtomicUint { v : v }
218+ AtomicUint { v : v, nocopy : NonCopyable }
213219 }
214220
215221 #[ inline]
@@ -247,7 +253,7 @@ impl AtomicUint {
247253
248254impl < T > AtomicPtr < T > {
249255 pub fn new ( p : * mut T ) -> AtomicPtr < T > {
250- AtomicPtr { p : p }
256+ AtomicPtr { p : p, nocopy : NonCopyable }
251257 }
252258
253259 #[ inline]
0 commit comments