v0ldem0rt
07/21/2018, 9:36 PMVsevolod Tolstopyatov [JB]
07/22/2018, 11:26 AMv0ldem0rt
07/22/2018, 2:11 PMgroostav
07/22/2018, 10:50 PMkotlinx.collections.immutable
and kotlinx.coroutines...Mutex
, those two in conjunction should could you pretty straight-forward concurrency.java.util.concurrent
packages with kotlinx.coroutines
ones, needless to say the results can be pretty strange deadlock. As a result I've put in place a "one or the other" rule, where we simply fobid mixing and matching those two packagesv0ldem0rt
07/23/2018, 3:35 PMSuspendableMap
that uses the Mutex and wraps the standard map to make it work.Vsevolod Tolstopyatov [JB]
07/23/2018, 4:11 PMSuspendableMap
will be visibly slower.
Usually it’s not worth to implement your own primitives instead of [well-tested and polished by years] already implemented ones even if there is a small probability of blocking. It’s worth doing after measuring and understanding that CHM is actually a bottleneck (which is unlikely true for an average application)