Skip to content

Commit a2a102b

Browse files
committed
Merge branch 'master' into develop
2 parents 2e25bae + c112be4 commit a2a102b

File tree

8 files changed

+16
-12
lines changed

8 files changed

+16
-12
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ And make sure that you use the latest Kotlin version:
135135

136136
```groovy
137137
plugins {
138-
kotlin("jvm") version "1.5.20"
138+
kotlin("jvm") version "1.5.30"
139139
}
140140
```
141141

docs/topics/cancellation-and-timeouts.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ If you run the above code you'll see that it does not always print zero, though
388388
of your machine you may need to tweak timeouts in this example to actually see non-zero values.
389389

390390
> Note, that incrementing and decrementing `acquired` counter here from 100K coroutines is completely safe,
391-
> since it always happens from the same main thread. More on that will be explained in the next chapter
391+
> since it always happens from the same main thread. More on that will be explained in the chapter
392392
> on coroutine context.
393393
>
394394
{type="note"}

docs/topics/coroutines-basics.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ Coroutines follow a principle of
7575
which delimits the lifetime of the coroutine. The above example shows that [runBlocking] establishes the corresponding
7676
scope and that is why the previous example waits until `World!` is printed after a second's delay and only then exits.
7777

78-
In the real application, you will be launching a lot of coroutines. Structured concurrency ensures that they are not
78+
In a real application, you will be launching a lot of coroutines. Structured concurrency ensures that they are not
7979
lost and do not leak. An outer scope cannot complete until all its children coroutines complete.
8080
Structured concurrency also ensures that any errors in the code are properly reported and are never lost.
8181

docs/topics/exception-handling.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ When these builders are used to create a _root_ coroutine, that is not a _child_
1515
the former builders treat exceptions as **uncaught** exceptions, similar to Java's `Thread.uncaughtExceptionHandler`,
1616
while the latter are relying on the user to consume the final
1717
exception, for example via [await][Deferred.await] or [receive][ReceiveChannel.receive]
18-
([produce] and [receive][ReceiveChannel.receive] are covered later in [Channels](https://github.com/Kotlin/kotlinx.coroutines/blob/master/docs/channels.md) section).
18+
([produce] and [receive][ReceiveChannel.receive] are covered in [Channels](https://github.com/Kotlin/kotlinx.coroutines/blob/master/docs/channels.md) section).
1919

2020
It can be demonstrated by a simple example that creates root coroutines using the [GlobalScope]:
2121

@@ -68,7 +68,7 @@ Caught ArithmeticException
6868
## CoroutineExceptionHandler
6969

7070
It is possible to customize the default behavior of printing **uncaught** exceptions to the console.
71-
[CoroutineExceptionHandler] context element on a _root_ coroutine can be used as generic `catch` block for
71+
[CoroutineExceptionHandler] context element on a _root_ coroutine can be used as a generic `catch` block for
7272
this root coroutine and all its children where custom exception handling may take place.
7373
It is similar to [`Thread.uncaughtExceptionHandler`](https://docs.oracle.com/javase/8/docs/api/java/lang/Thread.html#setUncaughtExceptionHandler(java.lang.Thread.UncaughtExceptionHandler)).
7474
You cannot recover from the exception in the `CoroutineExceptionHandler`. The coroutine had already completed
@@ -349,7 +349,7 @@ hierarchy of coroutines. Let us take a look at the case when unidirectional canc
349349

350350
A good example of such a requirement is a UI component with the job defined in its scope. If any of the UI's child tasks
351351
have failed, it is not always necessary to cancel (effectively kill) the whole UI component,
352-
but if UI component is destroyed (and its job is cancelled), then it is necessary to fail all child jobs as their results are no longer needed.
352+
but if the UI component is destroyed (and its job is cancelled), then it is necessary to cancel all child jobs as their results are no longer needed.
353353

354354
Another example is a server process that spawns multiple child jobs and needs to _supervise_
355355
their execution, tracking their failures and only restarting the failed ones.

docs/topics/select-expression.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ Channel 'a' is closed
213213

214214
<!--- TEST -->
215215

216-
There are couple of observations to make out of it.
216+
There are a couple of observations to make out of it.
217217

218218
First of all, `select` is _biased_ to the first clause. When several clauses are selectable at the same time,
219219
the first one among them gets selected. Here, both channels are constantly producing strings, so `a` channel,
@@ -228,7 +228,7 @@ channel is already closed.
228228
Select expression has [onSend][SendChannel.onSend] clause that can be used for a great good in combination
229229
with a biased nature of selection.
230230

231-
Let us write an example of producer of integers that sends its values to a `side` channel when
231+
Let us write an example of a producer of integers that sends its values to a `side` channel when
232232
the consumers on its primary channel cannot keep up with it:
233233

234234
```kotlin

docs/topics/shared-mutable-state-and-concurrency.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ but others are unique.
99

1010
## The problem
1111

12-
Let us launch a hundred coroutines all doing the same action thousand times.
12+
Let us launch a hundred coroutines all doing the same action a thousand times.
1313
We'll also measure their completion time for further comparisons:
1414

1515
```kotlin
@@ -384,7 +384,7 @@ single reference to the actor can be carried around as its handle.
384384
The first step of using an actor is to define a class of messages that an actor is going to process.
385385
Kotlin's [sealed classes](https://kotlinlang.org/docs/reference/sealed-classes.html) are well suited for that purpose.
386386
We define `CounterMsg` sealed class with `IncCounter` message to increment a counter and `GetCounter` message
387-
to get its value. The later needs to send a response. A [CompletableDeferred] communication
387+
to get its value. The latter needs to send a response. A [CompletableDeferred] communication
388388
primitive, that represents a single value that will be known (communicated) in the future,
389389
is used here for that purpose.
390390

kotlinx-coroutines-core/common/src/flow/Channels.kt

+5-1
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,11 @@ public fun <T> BroadcastChannel<T>.asFlow(): Flow<T> = flow {
182182
* Creates a [produce] coroutine that collects the given flow.
183183
*
184184
* This transformation is **stateful**, it launches a [produce] coroutine
185-
* that collects the given flow and thus resulting channel should be properly closed or cancelled.
185+
* that collects the given flow, and has the same behavior:
186+
*
187+
* * if collecting the flow throws, the channel will be closed with that exception
188+
* * if the [ReceiveChannel] is cancelled, the collection of the flow will be cancelled
189+
* * if collecting the flow completes normally, the [ReceiveChannel] will be closed normally
186190
*
187191
* A channel with [default][Channel.Factory.BUFFERED] buffer size is created.
188192
* Use [buffer] operator on the flow before calling `produceIn` to specify a value other than

reactive/kotlinx-coroutines-rx2/src/RxCompletable.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public fun rxCompletable(
2020
context: CoroutineContext = EmptyCoroutineContext,
2121
block: suspend CoroutineScope.() -> Unit
2222
): Completable {
23-
require(context[Job] === null) { "Completable context cannot contain job in it." +
23+
require(context[Job] === null) { "Completable context cannot contain job in it. " +
2424
"Its lifecycle should be managed via Disposable handle. Had $context" }
2525
return rxCompletableInternal(GlobalScope, context, block)
2626
}

0 commit comments

Comments
 (0)