Roman Elizarov | 98b7a6e | 2017-06-07 08:43:43 +0300 | [diff] [blame] | 1 | /* |
Roman Elizarov | 1f74a2d | 2018-06-29 19:19:45 +0300 | [diff] [blame^] | 2 | * Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. |
Roman Elizarov | 98b7a6e | 2017-06-07 08:43:43 +0300 | [diff] [blame] | 3 | */ |
| 4 | |
| 5 | package kotlinx.coroutines.experimental.channels |
| 6 | |
| 7 | import kotlinx.coroutines.experimental.* |
| 8 | import org.junit.Test |
| 9 | |
| 10 | class DoubleChannelCloseStressTest : TestBase() { |
| 11 | val nTimes = 1000 * stressTestMultiplier |
| 12 | |
| 13 | @Test |
| 14 | fun testDoubleCloseStress() { |
| 15 | repeat(nTimes) { |
| 16 | val actor = actor<Int>(CommonPool + CoroutineName("actor"), start = CoroutineStart.LAZY) { |
| 17 | // empty -- just closes channel |
| 18 | } |
| 19 | launch(CommonPool + CoroutineName("sender")) { |
| 20 | actor.send(1) |
| 21 | } |
| 22 | Thread.sleep(1) |
| 23 | actor.close() |
| 24 | } |
| 25 | } |
Vsevolod Tolstopyatov | 9619134 | 2018-04-20 18:13:33 +0300 | [diff] [blame] | 26 | } |