[Ebooks PDF] download Modern Concurrency on Apple Platforms: Using async/await with Swift 1st Edition Andrés Ibañez Kautsch full chapters
[Ebooks PDF] download Modern Concurrency on Apple Platforms: Using async/await with Swift 1st Edition Andrés Ibañez Kautsch full chapters
com
https://ebookmeta.com/product/modern-concurrency-on-apple-
platforms-using-async-await-with-swift-1st-edition-andres-
ibanez-kautsch/
OR CLICK HERE
DOWLOAD NOW
https://ebookmeta.com/product/modern-concurrency-on-apple-platforms-
using-async-await-with-swift-1st-edition-andres-ibanez-kautsch/
ebookmeta.com
https://ebookmeta.com/product/statistical-analysis-with-swift-data-
sets-statistical-models-and-predictions-on-apple-platforms-andersson/
ebookmeta.com
https://ebookmeta.com/product/chess-explained-the-c3-sicilian-1st-
edition-sam-collins/
ebookmeta.com
https://ebookmeta.com/product/on-borrowed-time-how-the-growth-in-
entitlement-spending-threatens-america-s-future-1st-edition-neil-howe/
ebookmeta.com
Her Ferocious Mates 03 0 Wolf Mated 1st Edition Kaylin
Peyerk
https://ebookmeta.com/product/her-ferocious-mates-03-0-wolf-mated-1st-
edition-kaylin-peyerk/
ebookmeta.com
https://ebookmeta.com/product/mathematical-modeling-and-simulation-
case-studies-on-drilling-operations-in-the-ore-mining-industry-1st-
edition/
ebookmeta.com
https://ebookmeta.com/product/otter-best-cake-ever-sam-garton/
ebookmeta.com
https://ebookmeta.com/product/hunter-rosewood-high-5-1st-edition-
tracy-lorraine/
ebookmeta.com
https://ebookmeta.com/product/a-crown-of-iron-silver-hailey-turner/
ebookmeta.com
Introduction to the Psychoanalysis of Mallarme Charles
Mauron
https://ebookmeta.com/product/introduction-to-the-psychoanalysis-of-
mallarme-charles-mauron/
ebookmeta.com
Modern
Concurrency on
Apple Platforms
Using async/await with Swift
—
Andrés Ibañez Kautsch
Modern Concurrency
on Apple Platforms
Using async/await with Swift
Acknowledgments�����������������������������������������������������������������������������xiii
Preface�����������������������������������������������������������������������������������������������xv
Chapter 1: Introduction������������������������������������������������������������������������1
Important Concepts to Know���������������������������������������������������������������������������������2
Threads������������������������������������������������������������������������������������������������������������3
Concurrency and Asynchronous Programming�����������������������������������������������3
Multithreading Pitfalls�������������������������������������������������������������������������������������6
Existing Multithreading and Concurrency Tools���������������������������������������������13
Introducing async/await��������������������������������������������������������������������������������20
Requirements������������������������������������������������������������������������������������������������������21
Summary������������������������������������������������������������������������������������������������������������22
Exercises�������������������������������������������������������������������������������������������������������������23
v
Table of Contents
Chapter 3: Continuations��������������������������������������������������������������������53
Understanding Continuations������������������������������������������������������������������������������54
Converting closure-based calls into async/await������������������������������������������54
Converting delegate-based code into async/await���������������������������������������58
Supporting async/await in iOS 13 and 14�����������������������������������������������������66
Summary������������������������������������������������������������������������������������������������������������72
Exercises�������������������������������������������������������������������������������������������������������������72
vi
Table of Contents
Chapter 6: Actors������������������������������������������������������������������������������117
Introducing Actors���������������������������������������������������������������������������������������������118
Interacting with an Actor�����������������������������������������������������������������������������������120
Nonisolated Access to an Actor�������������������������������������������������������������������125
Actors and Protocol Conformance��������������������������������������������������������������������127
Actor Reentrancy����������������������������������������������������������������������������������������������129
Actors and Detached Tasks�������������������������������������������������������������������������������133
General Tips for Working with Actors����������������������������������������������������������������133
Summary����������������������������������������������������������������������������������������������������������135
Chapter 9: AsyncSequence���������������������������������������������������������������167
Introducing AsyncSequence������������������������������������������������������������������������������167
A Short Dive into Sequences and AsyncSequences������������������������������������169
AsyncSequence Concrete Types������������������������������������������������������������������170
vii
Table of Contents
AsyncSequence Example����������������������������������������������������������������������������������171
Native APIs That Use AsyncSequence���������������������������������������������������������177
The AsyncStream Object�����������������������������������������������������������������������������������177
The CoreLocationAsyncStream Project�������������������������������������������������������178
The AsyncThrowingStream Object��������������������������������������������������������������������190
Summary����������������������������������������������������������������������������������������������������������190
Index�������������������������������������������������������������������������������������������������197
viii
About the Author
Andrés Ibañez Kautsch started writing iOS
apps as a young college student in 2011. His
first introduction to concurrency programming
and its common pitfalls was in an operating
systems class that introduced the importance
(and complexity) of writing concurrent code.
Since then, he has studied how this problem
is solved in Apple’s platforms, including
iOS. Andy has worked in institutions that
make use of concurrent technologies to keep
their services running for their customers, including banks, applying the
concepts to their mobile applications.
ix
About the Technical Reviewer
Massimo Nardone has more than 22 years
of experience in security, web/mobile
development, and cloud and IT architecture.
His true IT passions are security and Android.
He has been programming and teaching
how to program with Android, Perl, PHP, Java,
VB, Python, C/C++, and MySQL for more than
20 years.
He holds a Master of Science degree in
Computing Science from the University of
Salerno, Italy.
He has worked as a project manager, software engineer, research
engineer, chief security architect, information security manager,
PCI/SCADA auditor, and senior lead IT security/cloud/SCADA architect
for many years.
xi
Acknowledgments
Whenever you decide to buy a technical book, you usually see one or two
author names, and maybe a reviewer attached to it, but there are a lot of
people involved in a single book, both directly and indirectly. It will not
be possible to acknowledge everyone who has helped make this book
possible, but I’d like to single out a few.
First, I’d like to give a big kudos to Alexis Marechal. Alexis has, in
short, saved my career as a software developer. Alexis is not only a great
teacher, but also a great friend. His teaching style has greatly inspired
mine, and I hope I can do justice to that in this book. A big thank-you
to Carlos Anibarro and Jose Luis Vera for their teachings and words of
encouragement as well.
Writing a book is something I have always wanted to do, but Ernesto
Campohermoso is the first person who ever asked me, “When are you
going to write a book?” That single question was a great push for this book
to come into existence.
Ivan Galarza is the first person I mentored in iOS development, and he
became a very reliable iOS engineer in a short time thanks to all the talent
he has. He was the ideal candidate to review a book in progress. His input
helped me make sure everything makes sense and that this book will be
something people would like to read.
A big thank-you to all the folks at Apress for the process that made
writing this book possible. The entire experience has been a joy, from
being contacted to write a book to turning in the final chapters. The final
form of this book would have not been possible without their tenacity and
amazing work ethic.
xiii
Acknowledgments
Finally, I’d like to give a big thanks to all the readers of my blog,
andyibanez.com. The comments and feedback I received in the original
tutorial series for this topic helped me greatly improve this book. I cannot
reply to every message I get, but I am thankful to all my readers. Thank
you all.
xiv
Preface
Concurrency is a topic a lot of developers find scary. And for good reason.
Concurrency is probably one of the most complicated topics in the world
of programming. When you look at it from a very high level, concurrency
allows us to do a lot of work at the same time. Sometimes related,
sometimes unrelated. The definition is simple, but as a programmer, it is
hard to reason about concurrent programs. We learn to write code that
can be read from top to bottom, and code usually makes sense when you
read it in such a manner. In fact, the way developers reason about code
is not too different to how non-programmers reason about a cooking
recipe. Humans can understand anything they read if it is structured and
makes sense.
But the very nature of concurrency breaks this top-to-bottom reading
flow. Not only do we need to reason about concurrency differently, but we
also need to keep in mind other factors that make it harder, such as shared
mutable data, locks, threads…. Concurrency is naturally very complicated,
especially when dealing with lower-level tools.
Luckily, the new async/await system, introduced in 2021, makes
concurrency easier to reason about because it abstracts a lot of the
complexity behind language-integrated features that are easy to use and
hard to misuse. If you have written concurrent code before with anything
other than async/await in any other platform (and that includes but is
not limited to iOS, macOS, and other Apple platforms), you do not have
to concern yourself with mutexes, semaphores, or any other low-level
concurrency primitives. If you have never written concurrent code before,
you can write amazing multithreaded software in a way that makes
sense without ever having to concern yourself with the complexities of
xv
Preface
traditional concurrency. This new system is very powerful and easy to use
for both developers familiar with concurrency as well as those who have
never written concurrent code before.
xvi
Preface
xvii
Another Random Document on
Scribd Without Any Related Topics
oratore, di solo degno competitore di Ortensio, senza pure aver l'aria
di pretensioso e vanitoso. Al tempo stesso, mette in rilievo con molta
intenzione la speciale figura, ch'egli avea in quel processo; si
schermisce dalle censure, che il compito di accusatore, compito
oramai discreditato, poteva attirargli, e cerca di togliere
assolutamente alla causa l'aspetto di un duello di carattere
personale, o di una semplice tenzone oratoria, per ridarle il suo
pieno significato politico e civile. Questo valore anzi disinteressato
della sua accusa e il sentimento di solidarietà sociale che l'inspira,
sono punti, su cui Cicerone torna ed insiste anche più volte in
appresso, e la sua eloquenza e la sua persona si rilevano molto,
sotto quella favorevole luce e lo mettono a parte, e al di sopra, degli
altri oratori semplicemente forensi del suo tempo.
Di questo stesso prologo del giudizio profittò intanto Cicerone per
dare come un prospetto di tutta la causa, mettere Verre nella luce
più fosca, cercare di sgominare tutte le mene sue e de' suoi fautori e
protettori e fare i primi attacchi, benchè in forma velata e
condizionale, contro i tribunali senatorî.
Da questa prima prova Cicerone uscì trionfante. Non solo riuscì ad
ottenere che a lui si affidasse l'accusa; ma evitò anche che gli si
aggiungesse, come subscriptor, Cecilio, che avrebbe potuto essere
una spia ed un traditore, e, con lui, scartò anche i due, che Cecilio si
era aggregati come coaccusatori, L. Appuleio e Alieno, un uomo
questo, che aveva forza più ne' polmoni che nel cervello, e, con loro,
tutto l'altro infinito gregge di accusatori di occasione, i quali
indifferentemente, a scopo di lucro o di vanità, tenevano ad unirsi
nell'accusa con chi che sia [635].
La vittoria di Cicerone dipese essa, tutta, dalla sua eloquenza, o dalle
premure di tutti que' legati di Sicilia, che, mentre parlava, gli facevan
corona? o dalla considerazione da lui stesso messa innanzi che
l'accusa sua fosse quella meglio atta a dispiacere a Verre e
soddisfare a' Siciliani? o finalmente dalla persuasione che Cecilio
fosse davvero un falso accusatore? Tutte le ragioni vi contribuirono
un po'; ma, oltre alle considerazioni politiche e al merito di Cicerone,
dovè concorrere molto a fare escludere Cecilio, secondo un'antica
consuetudine [636], la stessa carica di questore, ch'egli occupò già
presso Verre e che lo avea fatto, se non proprio partecipe,
assenziente almeno in qualche modo agli atti di Verre [637].
L'inquisizione di Cicerone.
Il danno e il risarcimento.