Xamarin: Cross-Platform Mobile Application Development
by Jonathan Peppers, George Taskos, Can Bilgin
Parallel execution
In the previous section, the discussion was centered on the System.Threading.Tasks namespace and the Task class. Even though tasks are the cornerstone of the task-based asynchronous model and so-called Task Parallelism, the concurrent collections namespace makes up the Data Parallelism side of the async model and provides developers with tools to execute code most efficiently and in a thread-safe manner.
BlockingCollection<T> is one of the concurrent collection implementations that encapsulates the core synchronization and coordination between threads and provides a thread-safe data storage to implement a provider-consumer model in Xamarin applications.
Using BlockingCollection<T>, we can easily implement a new method that makes ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access