Vsevolod Tolstopyatov | 9619134 | 2018-04-20 18:13:33 +0300 | [diff] [blame] | 1 | package kotlinx.coroutines.experimental.internal |
| 2 | |
| 3 | /** |
| 4 | * Special kind of list intended to be used as collection of subscribers in [ArrayBroadcastChannel] |
| 5 | * On JVM it's CopyOnWriteList and on JS it's MutableList. |
| 6 | * |
| 7 | * Note that this alias is intentionally not named as CopyOnWriteList to avoid accidental misusage outside of ArrayBroadcastChannel |
| 8 | */ |
Roman Elizarov | 11d6b5b | 2018-04-26 10:11:50 +0300 | [diff] [blame] | 9 | internal typealias SubscribersList<E> = MutableList<E> |
Vsevolod Tolstopyatov | 9619134 | 2018-04-20 18:13:33 +0300 | [diff] [blame] | 10 | |
Roman Elizarov | 11d6b5b | 2018-04-26 10:11:50 +0300 | [diff] [blame] | 11 | internal expect fun <E> subscriberList(): SubscribersList<E> |
Vsevolod Tolstopyatov | 9619134 | 2018-04-20 18:13:33 +0300 | [diff] [blame] | 12 | |
Roman Elizarov | 11d6b5b | 2018-04-26 10:11:50 +0300 | [diff] [blame] | 13 | internal expect class ReentrantLock() { |
Vsevolod Tolstopyatov | 9619134 | 2018-04-20 18:13:33 +0300 | [diff] [blame] | 14 | fun tryLock(): Boolean |
| 15 | fun unlock(): Unit |
| 16 | } |
| 17 | |
Roman Elizarov | 11d6b5b | 2018-04-26 10:11:50 +0300 | [diff] [blame] | 18 | internal expect inline fun <T> ReentrantLock.withLock(action: () -> T): T |