Created
October 17, 2021 07:58
-
-
Save takahirom/b1ed21c95d6f51bf530412354ab7d57e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val snapshot = Snapshot.takeMutableSnapshot() | |
thread { | |
viewModel.state.value = "changes from other thread" | |
} | |
snapshot.enter { | |
Thread.sleep(100) | |
println("in snapshot before change:" + viewModel.state) | |
viewModel.state.value = "change in snapshot" | |
println("in snapshot after change:" + viewModel.state) | |
} | |
snapshot.apply() | |
println("after apply:" + viewModel.state) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment