MCPcopy Create free account
hub / github.com/EdwardRaff/JSAT / getAndAdd

Method getAndAdd

JSAT/src/jsat/utils/concurrent/AtomicDouble.java:32–41  ·  view source on GitHub ↗
(double delta)

Source from the content-addressed store, hash-verified

30 }
31
32 public double getAndAdd(double delta)
33 {
34 while(true)
35 {
36 double orig = get();
37 double newVal = orig + delta;
38 if(compareAndSet(orig, newVal))
39 return orig;
40 }
41 }
42
43 /**
44 * Atomically adds the given value to the current value.

Callers 3

callMethod · 0.45
runMethod · 0.45
runMethod · 0.45

Calls 2

getMethod · 0.95
compareAndSetMethod · 0.95

Tested by

no test coverage detected