Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 197 /**
- 198 * Atomically increments by one the current value.
- 199 *
- 200 * @return the updated value
- 201 */
- 202 public final int incrementAndGet() {
- 203 for (;;) {
- 204 int current = get();
- 205 int next = current + 1;
- 206 if (compareAndSet(current, next))
- 207 return next;
- 208 }
- 209 }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement