• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2016-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
3  */
4 
5 package kotlinx.coroutines.internal
6 
7 /**
8  * Special kind of list intended to be used as collection of subscribers in `ArrayBroadcastChannel`
9  * On JVM it's CopyOnWriteList and on JS it's MutableList.
10  *
11  * Note that this alias is intentionally not named as CopyOnWriteList to avoid accidental misusage outside of ArrayBroadcastChannel
12  */
13 internal typealias SubscribersList<E> = MutableList<E>
14 
subscriberListnull15 internal expect fun <E> subscriberList(): SubscribersList<E>
16 
17 internal expect class ReentrantLock() {
18     fun tryLock(): Boolean
19     fun unlock(): Unit
20 }
21 
withLocknull22 internal expect inline fun <T> ReentrantLock.withLock(action: () -> T): T
23 
24 internal expect fun <E> identitySet(expectedSize: Int): MutableSet<E>
25