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,
2030
+
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,
2031
2031
and a channel to communicate with other coroutines. A simple actor can be written as a function,
2032
2032
but an actor with a complex state is better suited for a class.
2033
2033
@@ -2089,7 +2089,7 @@ Counter = 1000000
2089
2089
2090
2090
It does not matter (for correctness) what context the actor itself is executed in. An actor is
2091
2091
a coroutine and a coroutine is executed sequentially, so confinement of the state to the specific coroutine
2092
-
works as a solution to the problem of shared mutable state.
2092
+
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).
2093
2093
2094
2094
Actor is more efficient than locking under load, because in this case it always has work to do and it does not
2095
2095
have to switch to a different context at all.
@@ -2185,8 +2185,8 @@ buzz -> 'Buzz!'
2185
2185
2186
2186
### Selecting on close
2187
2187
2188
-
The [onReceive][ReceiveChannel.onReceive] clause in `select` fails when the channel is closed and the corresponding
2189
-
`select`throws an exception. We can use [onReceiveOrNull][ReceiveChannel.onReceiveOrNull] clause to perform a
2188
+
The [onReceive][ReceiveChannel.onReceive] clause in `select` fails when the channel is closed causing the corresponding
2189
+
`select`to throw an exception. We can use [onReceiveOrNull][ReceiveChannel.onReceiveOrNull] clause to perform a
2190
2190
specific action when the channel is closed. The following example also shows that `select` is an expression that returns
0 commit comments