wrt atomicfu - how does it relate to VarHandles? S...
# coroutines
m
wrt atomicfu - how does it relate to VarHandles? Seems similar in concept, albeit with nicer syntax?
d
VarHandles
are much lower level, basically just a "nice API for Unsafe". Atomicfu builds on the exising JDK libraries, like
AtomicInteger
, which provide a safe API, but might not be as performant and not offer everything you need. With VarHandles for example you can address individual array indices as if they were volatile, you can't do that with current JDK APIs.
e
In fact, I plan to emit JDK9-specific bytecode into
META-INF/versions
directory, so that your code work via `AxFU`classes on JDK<=1.8 and via VarHandles on JDK>=1.9
👍 3
d
That sounds very nice! VarHandles are great, but having a nice API for them is even better.