package coroutine_deepdiveimport kotlinx.coroutines.*import kotlinx.coroutines.sync.Muteximport kotlinx.coroutines.sync.withLockimport kotlin.system.measureTimeMillisclass MessagesRepository { private val messages = mutableListOf() private val mutex = Mutex() @OptIn(ExperimentalCoroutinesApi::class) private val dispatcher = Dispatchers.IO.limitedParallelism(10) suspend fun add(mes..