equal
deleted
inserted
replaced
162 int x = UNSAFE.getIntVolatile(base, offset); |
162 int x = UNSAFE.getIntVolatile(base, offset); |
163 assertEquals(x, 1, "putRelease int value"); |
163 assertEquals(x, 1, "putRelease int value"); |
164 } |
164 } |
165 |
165 |
166 |
166 |
|
167 |
167 UNSAFE.putInt(base, offset, 1); |
168 UNSAFE.putInt(base, offset, 1); |
168 |
169 |
169 // Compare |
170 // Compare |
170 { |
171 { |
171 boolean r = UNSAFE.compareAndSwapInt(base, offset, 1, 2); |
172 boolean r = UNSAFE.compareAndSwapInt(base, offset, 1, 2); |
178 boolean r = UNSAFE.compareAndSwapInt(base, offset, 1, 3); |
179 boolean r = UNSAFE.compareAndSwapInt(base, offset, 1, 3); |
179 assertEquals(r, false, "failing compareAndSwap int"); |
180 assertEquals(r, false, "failing compareAndSwap int"); |
180 int x = UNSAFE.getInt(base, offset); |
181 int x = UNSAFE.getInt(base, offset); |
181 assertEquals(x, 2, "failing compareAndSwap int value"); |
182 assertEquals(x, 2, "failing compareAndSwap int value"); |
182 } |
183 } |
|
184 |
183 |
185 |
184 // Compare set and get |
186 // Compare set and get |
185 { |
187 { |
186 int o = UNSAFE.getAndSetInt(base, offset, 1); |
188 int o = UNSAFE.getAndSetInt(base, offset, 1); |
187 assertEquals(o, 2, "getAndSet int"); |
189 assertEquals(o, 2, "getAndSet int"); |
207 int x = UNSAFE.getInt(address); |
209 int x = UNSAFE.getInt(address); |
208 assertEquals(x, 1, "set int value"); |
210 assertEquals(x, 1, "set int value"); |
209 } |
211 } |
210 } |
212 } |
211 } |
213 } |
|
214 |