groostav
04/19/2018, 11:35 PMSequentialPoolExecutorsubmitexecuteclass SomeStatefulComponent {
  private val data = MutableDataStructureThatIsntThreadSafe()
  suspend fun doMutation(args: Args): Double = run(SequentialExecutor) { 
    data += transform(args)
    return data.moreComputation()
  }
}@VolatileUnsafeAtomicReference@VolatiledataVsevolod Tolstopyatov [JB]
04/20/2018, 8:19 AMEffectively this boils down to an apocalyptic assumption: is it really the case that fields not marked for explicit thread sharing cannot ever be shared between threads?It’s not. This is a classic problem which arises with advanced concurrency and JMM (Java Memory Model) 🙂 Even though it’s useful to know what stays behind
volatilehappens-beforehappens-beforeVsevolod Tolstopyatov [JB]
04/20/2018, 8:23 AMvolatilesynchronizedj.u.c.Lockhappens-beforehappens-before