Atomically adds the given value to the current value. @param delta the value to add @return the updated value
(double delta)
| 47 | * @return the updated value |
| 48 | */ |
| 49 | public final double addAndGet(double delta) |
| 50 | { |
| 51 | while(true) |
| 52 | { |
| 53 | double orig = get(); |
| 54 | double newVal = orig + delta; |
| 55 | if (compareAndSet(orig, newVal)) |
| 56 | return newVal; |
| 57 | } |
| 58 | } |
| 59 | |
| 60 | public boolean compareAndSet(double expect, double update) |
| 61 | { |
no test coverage detected