https://kotlinlang.org logo
#coroutines
Title
# coroutines
m

mikehearn

08/10/2017, 2:36 PM
wrt atomicfu - how does it relate to VarHandles? Seems similar in concept, albeit with nicer syntax?
d

diesieben07

08/10/2017, 2:38 PM
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

elizarov

08/10/2017, 2:53 PM
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

diesieben07

08/10/2017, 3:04 PM
That sounds very nice! VarHandles are great, but having a nice API for them is even better.
4 Views