Modern Concurrency on Apple Platforms : Using Async/await with Swift
معرفی کتاب «Modern Concurrency on Apple Platforms : Using Async/await with Swift» نوشتهٔ Gabrielle Stanley Blair و Andrés Ibañez Kautsch، منتشرشده توسط نشر Apress : Imprint: Apress در سال 2023. این کتاب در فرمت pdf، زبان انگلیسی ارائه شده است.
Build solid software with modern and safe concurrency features. Concurrency is one of the hardest problems in computer science. For years, computer scientists and engineers have developed different strategies for dealing with concurrency. However, the original concurrency primitives are complicated and difficult to understand, and even harder to implement. Using the new async/await APIs in Swift, this book will explain how your code can abstract a lot of the complexity with a simpler interface so you never have to deal with concurrency primitives such as semaphores, locks, and threads yourself. This will allow you to write concurrent code that is easier to read, easier to write, and easier to maintain. These new APIs are deeply ingrained into Swift, offering compile-level features that will keep you from writing dangerous concurrent code. You’ll start by exploring why concurrency is hard to implement in a traditional system. Explaining the definition of concurrency and what its primitives are will help you understand why they are hard to use correctly. These concepts will become clearer as you work through the sample projects. The book’s focus then shifts exclusively to the new APIs, helping you understand how the integration of the system with the language itself makes it easier for you to write concurrent code without overstepping the bounds of the concurrency safe zone. By the end of the book, you’ll have a solid foundation for working safely with concurrent code using the new async/await APIs. What You'll Learn Understand concurrency and its traditional problems Work with the new async/await API and all its features, from the basic usage and await keywords, to task groups and async sequences. Implement modern and safe concurrent code that you can start using right away Who This Book Is For Experienced iOS developers at a semi-senior or senior level. Knowledge on the Grand Central Dispatch is a bonus, but not required. Table of Contents About the Author About the Technical Reviewer Acknowledgments Preface Chapter 1: Introduction Important Concepts to Know Threads Concurrency and Asynchronous Programming Multithreading Pitfalls Deadlocks Solving the Deadlocking Problem Mutex Semaphores Starvation Race Conditions Livelocks Existing Multithreading and Concurrency Tools pthreads NSThreads The Grand Central Dispatch (GCD) The NSOperation APIs Introducing async/await Requirements Summary Exercises Chapter 2: Introducing async/await Closures and Their Place in Concurrency and Multithreading Getting Started with async/await The async keyword The await keyword Using async/await async get properties async/await in iOS 13 and iOS 14 Summary Exercises Chapter 3: Continuations Understanding Continuations Converting closure-based calls into async/await Converting delegate-based code into async/await The ContactPicker Project Wrapping delegate-based calls in async/await alternatives Supporting async/await in iOS 13 and 14 Summary Exercises Chapter 4: Structured Concurrency Understanding Structured Concurrency The async let construct Task Groups Task Groups in Action The Image Downloader Project Summary Exercises Chapter 5: Unstructured Concurrency Tasks in Depth Creating Tasks Unstructured Concurrency in Action Modifying the ImageManager Class Modifying the ContentViewViewModel Class Modifying the ContentView Object The Task Tree Error Propagation Task Cancellation Task Cancellation and Task Groups Unstructured Concurrency with Detached Tasks Summary Exercises Chapter 6: Actors Introducing Actors Interacting with an Actor Nonisolated Access to an Actor Actors and Protocol Conformance Actor Reentrancy Actors and Detached Tasks General Tips for Working with Actors Summary Chapter 7: Sendable Types Understanding Sendable Types The Sendable Protocol Analyzing Sendable Types Structs Classes Closures Summary Chapter 8: The Main Actor & Final Actors The Main Thread The Main Actor Using the @MainActor Understanding Global Actors Creating Global Actors Summary Chapter 9: AsyncSequence Introducing AsyncSequence A Short Dive into Sequences and AsyncSequences AsyncSequence Concrete Types AsyncSequence Example Native APIs That Use AsyncSequence The AsyncStream Object The CoreLocationAsyncStream Project The LocationUpdater Class Asking for Location Usage Permission Receiving Locations in a Loop Finishing the Project The AsyncThrowingStream Object Summary Chapter 10: @TaskLocal Introducing the @TaskLocal Property Wrapper Using @TaskLocal Summary Index
دانلود کتاب Modern Concurrency on Apple Platforms : Using Async/await with Swift