1 *java.util.concurrent.atomic.AtomicMarkableReference* *AtomicMarkableReference*
3 public class AtomicMarkableReference
4 extends |java.lang.Object|
6 |java.util.concurrent.atomic.AtomicMarkableReference_Description|
7 |java.util.concurrent.atomic.AtomicMarkableReference_Fields|
8 |java.util.concurrent.atomic.AtomicMarkableReference_Constructors|
9 |java.util.concurrent.atomic.AtomicMarkableReference_Methods|
11 ================================================================================
13 *java.util.concurrent.atomic.AtomicMarkableReference_Constructors*
14 |java.util.concurrent.atomic.AtomicMarkableReference(V,boolean)|Creates a new A
16 *java.util.concurrent.atomic.AtomicMarkableReference_Methods*
17 |java.util.concurrent.atomic.AtomicMarkableReference.attemptMark(V,boolean)|Ato
18 |java.util.concurrent.atomic.AtomicMarkableReference.compareAndSet(V,V,boolean,boolean)|
19 |java.util.concurrent.atomic.AtomicMarkableReference.get(boolean[])|Returns the
20 |java.util.concurrent.atomic.AtomicMarkableReference.getReference()|Returns the
21 |java.util.concurrent.atomic.AtomicMarkableReference.isMarked()|Returns the cur
22 |java.util.concurrent.atomic.AtomicMarkableReference.set(V,boolean)|Uncondition
23 |java.util.concurrent.atomic.AtomicMarkableReference.weakCompareAndSet(V,V,boolean,boolean)|
25 *java.util.concurrent.atomic.AtomicMarkableReference_Description*
27 An AtomicMarkableReference maintains an object reference along with a mark bit,
28 that can be updated atomically.
30 Implementation note. This implementation maintains markable references by
31 creating internal objects representing "boxed" [reference, boolean] pairs.
34 *java.util.concurrent.atomic.AtomicMarkableReference(V,boolean)*
36 public AtomicMarkableReference(
37 java.lang.Object initialRef,
40 Creates a new AtomicMarkableReference with the given initial values.
42 initialRef - the initial reference
43 initialMark - the initial mark
45 *java.util.concurrent.atomic.AtomicMarkableReference.attemptMark(V,boolean)*
47 public boolean attemptMark(
48 java.lang.Object expectedReference,
51 Atomically sets the value of the mark to the given update value if the current
52 reference is == to the expected reference. Any given invocation of this
53 operation may fail (return false) spuriously, but repeated invocation when the
54 current value holds the expected value and no other thread is also attempting
55 to set the value will eventually succeed.
57 expectedReference - the expected value of the reference
58 newMark - the new value for the mark
60 Returns: true if successful
61 *java.util.concurrent.atomic.AtomicMarkableReference.compareAndSet(V,V,boolean,boolean)*
63 public boolean compareAndSet(
64 java.lang.Object expectedReference,
65 java.lang.Object newReference,
69 Atomically sets the value of both the reference and mark to the given update
70 values if the current reference is == to the expected reference and the current
71 mark is equal to the expected mark.
73 expectedReference - the expected value of the reference
74 newReference - the new value for the reference
75 expectedMark - the expected value of the mark
76 newMark - the new value for the mark
78 Returns: true if successful
79 *java.util.concurrent.atomic.AtomicMarkableReference.get(boolean[])*
81 public |java.lang.Object| get(boolean[] markHolder)
83 Returns the current values of both the reference and the mark. Typical usage is
84 boolean[1] holder; ref = v.get(holder); .
86 markHolder - an array of size of at least one. On return, markholder[0] will hold the value
89 Returns: the current value of the reference
90 *java.util.concurrent.atomic.AtomicMarkableReference.getReference()*
92 public |java.lang.Object| getReference()
94 Returns the current value of the reference.
97 Returns: the current value of the reference
98 *java.util.concurrent.atomic.AtomicMarkableReference.isMarked()*
100 public boolean isMarked()
102 Returns the current value of the mark.
105 Returns: the current value of the mark
106 *java.util.concurrent.atomic.AtomicMarkableReference.set(V,boolean)*
109 java.lang.Object newReference,
112 Unconditionally sets the value of both the reference and mark.
114 newReference - the new value for the reference
115 newMark - the new value for the mark
117 *java.util.concurrent.atomic.AtomicMarkableReference.weakCompareAndSet(V,V,boolean,boolean)*
119 public boolean weakCompareAndSet(
120 java.lang.Object expectedReference,
121 java.lang.Object newReference,
122 boolean expectedMark,
125 Atomically sets the value of both the reference and mark to the given update
126 values if the current reference is == to the expected reference and the current
127 mark is equal to the expected mark. Any given invocation of this operation may
128 fail (return false) spuriously, but repeated invocation when the current value
129 holds the expected value and no other thread is also attempting to set the
130 value will eventually succeed.
132 expectedReference - the expected value of the reference
133 newReference - the new value for the reference
134 expectedMark - the expected value of the mark
135 newMark - the new value for the mark
137 Returns: true if successful