You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
An actor is a combination of a coroutine, the state that is confined and is encapsulated into this coroutine,
2018
+
An [actor](https://en.wikipedia.org/wiki/Actor_model) is an entity made up of a combination of a coroutine, the state that is confined and encapsulated into this coroutine,
2019
2019
and a channel to communicate with other coroutines. A simple actor can be written as a function,
2020
2020
but an actor with a complex state is better suited for a class.
2021
2021
@@ -2077,7 +2077,7 @@ Counter = 1000000
2077
2077
2078
2078
It does not matter (for correctness) what context the actor itself is executed in. An actor is
2079
2079
a coroutine and a coroutine is executed sequentially, so confinement of the state to the specific coroutine
2080
-
works as a solution to the problem of shared mutable state.
2080
+
works as a solution to the problem of shared mutable state. Indeed, actors may modify their own private state, but can only affect each other through messages (avoiding the need for any locks).
2081
2081
2082
2082
Actor is more efficient than locking under load, because in this case it always has work to do and it does not
2083
2083
have to switch to a different context at all.
@@ -2173,8 +2173,8 @@ buzz -> 'Buzz!'
2173
2173
2174
2174
### Selecting on close
2175
2175
2176
-
The [onReceive][ReceiveChannel.onReceive] clause in `select` fails when the channel is closed and the corresponding
2177
-
`select`throws an exception. We can use [onReceiveOrNull][ReceiveChannel.onReceiveOrNull] clause to perform a
2176
+
The [onReceive][ReceiveChannel.onReceive] clause in `select` fails when the channel is closed causing the corresponding
2177
+
`select`to throw an exception. We can use [onReceiveOrNull][ReceiveChannel.onReceiveOrNull] clause to perform a
2178
2178
specific action when the channel is closed. The following example also shows that `select` is an expression that returns
0 commit comments