Advertisement
Guest User

Untitled

a guest
Aug 25th, 2016
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. 197 /**
  2. 198 * Atomically increments by one the current value.
  3. 199 *
  4. 200 * @return the updated value
  5. 201 */
  6. 202 public final int incrementAndGet() {
  7. 203 for (;;) {
  8. 204 int current = get();
  9. 205 int next = current + 1;
  10. 206 if (compareAndSet(current, next))
  11. 207 return next;
  12. 208 }
  13. 209 }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement