Roman Elizarov | f16fd27 | 2017-02-07 11:26:00 +0300 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2016-2017 JetBrains s.r.o. |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
Roman Elizarov | 187eace | 2017-01-31 09:39:58 +0300 | [diff] [blame] | 17 | package kotlinx.coroutines.experimental.channels |
| 18 | |
Roman Elizarov | 187eace | 2017-01-31 09:39:58 +0300 | [diff] [blame] | 19 | /** |
| 20 | * Rendezvous channel. This channel does not have any buffer at all. An element is transferred from sender |
| 21 | * to receiver only when [send] and [receive] invocations meet in time (rendezvous), so [send] suspends |
| 22 | * until another coroutine invokes [receive] and [receive] suspends until another coroutine invokes [send]. |
Roman Elizarov | 7b2d8b0 | 2017-02-02 20:09:14 +0300 | [diff] [blame] | 23 | * |
Roman Elizarov | f2a710a | 2017-07-21 18:33:59 +0300 | [diff] [blame] | 24 | * Use `Channel()` factory function to conveniently create an instance of rendezvous channel. |
| 25 | * |
Roman Elizarov | 7b2d8b0 | 2017-02-02 20:09:14 +0300 | [diff] [blame] | 26 | * This implementation is fully lock-free. |
Roman Elizarov | 187eace | 2017-01-31 09:39:58 +0300 | [diff] [blame] | 27 | */ |
Roman Elizarov | 0a78839 | 2017-02-15 17:52:12 +0300 | [diff] [blame] | 28 | public open class RendezvousChannel<E> : AbstractChannel<E>() { |
Roman Elizarov | 2ad0e94 | 2017-02-28 19:14:08 +0300 | [diff] [blame] | 29 | protected final override val isBufferAlwaysEmpty: Boolean get() = true |
Roman Elizarov | 0a78839 | 2017-02-15 17:52:12 +0300 | [diff] [blame] | 30 | protected final override val isBufferEmpty: Boolean get() = true |
Roman Elizarov | 2ad0e94 | 2017-02-28 19:14:08 +0300 | [diff] [blame] | 31 | protected final override val isBufferAlwaysFull: Boolean get() = true |
Roman Elizarov | 0a78839 | 2017-02-15 17:52:12 +0300 | [diff] [blame] | 32 | protected final override val isBufferFull: Boolean get() = true |
Roman Elizarov | 187eace | 2017-01-31 09:39:58 +0300 | [diff] [blame] | 33 | } |