Lulu
11/23/2019, 3:33 AMMutex
uses atomics internally too and that made me more confused. I also don't fully understand how atomics work in the first place, like in what case would they lock the object? Would putting my map in an atomic guarantees the operations performed will be synchronized? etcoctylFractal
11/23/2019, 3:35 AMConcurrentHashMap
, otherwise just wrap the Mutex
around each call to the map, like a synchronizedMap
does.
Alternatively, set up a single "owning" coroutine actor, that reads from a Channel. The Channel will hold messages telling it either to write to the map or read a value into a CompletableDeferred, and since the actor is the only one using the map, it doesn't need any thread-safety.Lulu
11/23/2019, 3:37 AMoctylFractal
11/23/2019, 3:44 AMLulu
11/23/2019, 3:56 AMuli
11/23/2019, 9:39 AMLulu
11/23/2019, 9:40 AMuli
11/23/2019, 9:41 AMLulu
11/23/2019, 9:42 AMuli
11/23/2019, 9:43 AMjimn
11/24/2019, 5:23 AM