© Andrés Ibañez Kautsch 2023
A. I. KautschModern Concurrency on Apple Platformshttps://doi.org/10.1007/978-1-4842-8695-1_8

8. The Main Actor & Final Actors

Andrés Ibañez Kautsch1  
(1)
La Paz, Bolivia
 

In Chapter 6, we learned about actors. Actors are reference types that synchronize their own internal state, so it is safe to mutate them from different threads. This is done by guaranteeing that only one task or thread can mutate the actor’s state at a time. Actors are sendable types meant to be used in a concurrent context. Actors are types that you instantiate and, for the most part, treat as normal classes. But what happens when we need something that is always guaranteed to run on the same thread, but when it may be spread out, even across different ...

Get Modern Concurrency on Apple Platforms: Using async/await with Swift now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.