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 ...

Get Xamarin: Cross-Platform Mobile Application Development 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.