blob: 330b02e52c2a22f989a3185742720179f8c98da8 [file] [log] [blame]
Roman Elizarov98b7a6e2017-06-07 08:43:43 +03001/*
Roman Elizarov1f74a2d2018-06-29 19:19:45 +03002 * Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
Roman Elizarov98b7a6e2017-06-07 08:43:43 +03003 */
4
5package kotlinx.coroutines.experimental.channels
6
7import kotlinx.coroutines.experimental.*
8import org.junit.Test
9
10class 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 Tolstopyatov96191342018-04-20 18:13:33 +030026}