Cargando…

Multithreading with C# Cookbook /

Over 70 recipes to get you writing powerful and efficient multithreaded, asynchronous, and parallel programs in C# 6.0 About This Book Rewritten and updated to take advantage of the latest C# 6 features Learn about multithreaded, asynchronous, and parallel programming through hands-on, code-first ex...

Descripción completa

Detalles Bibliográficos
Clasificación:Libro Electrónico
Autor principal: Agafonov, Eugene (Autor)
Formato: Electrónico eBook
Idioma:Inglés
Publicado: Birmingham, UK : Packt Publishing, 2016.
Edición:Second edition.
Temas:
Acceso en línea:Texto completo
Tabla de Contenidos:
  • Cover; Copyright; Credits; About the Author; About the Reviewers; www.PacktPub.com; Table of Contents; Preface; Chapter 1: Threading Basics; Introduction; Creating a thread in C#; Pausing a thread; Making a thread wait; Aborting a thread; Determining a thread state; Thread priority; Foreground and background threads; Passing parameters to a thread; Locking with a C# lock keyword; Locking with a Monitor construct; Handling exceptions; Chapter 2: Thread Synchronization; Introduction; Performing basic atomic operations; Using the Mutex construct; Using the SemaphoreSlim construct.
  • Using the AutoResetEvent constructUsing the ManualResetEventSlim construct; Using the CountDownEvent construct; Using the Barrier construct; Using the ReaderWriterLockSlim construct; Using the SpinWait construct; Chapter 3: Using a Thread Pool; Introduction; Invoking a delegate on a thread pool; Posting an asynchronous operation on a thread pool; A thread pool and the degree of parallelism; Implementing a cancellation option; Using a wait handle and timeout with a thread pool; Using a timer; Using the BackgroundWorker component; Chapter 4: Using the Task Parallel Library; Introduction.
  • Creating a taskPerforming basic operations with a task; Combining tasks; Converting the APM pattern to tasks; Converting the EAP pattern to tasks; Implementing a cancelation option; Handling exceptions in tasks; Running tasks in parallel; Tweaking the execution of tasks with TaskScheduler; Chapter 5: Using C# 6.0; Introduction; Using the await operator to get asynchronous task results; Using the await operator in a lambda expression; Using the await operator with consequent asynchronous tasks; Using the await operator for the execution of parallel asynchronous tasks.
  • Handling exceptions in asynchronous operationsAvoiding the use of the captured synchronization context; Working around the async void method; Designing a custom awaitable type; Using the dynamic type with await; Chapter 6: Using Concurrent Collections; Introduction; Using ConcurrentDictionary; Implementing asynchronous processing using ConcurrentQueue; Changing asynchronous processing order with ConcurrentStack; Creating a scalable crawler with ConcurrentBag; Generalizing asynchronous processing with BlockingCollection; Chapter 7: Using PLINQ; Introduction; Using the Parallel class.
  • Parallelizing a LINQ queryTweaking the parameters of a PLINQ query; Handling exceptions in a PLINQ query; Managing data partitioning in a PLINQ query; Creating a custom aggregator for a PLINQ query; Chapter 8: Reactive Extensions; Introduction; Converting a collection to an asynchronous Observable; Writing custom Observable; Using the Subjects type; Creating an Observable object; Using LINQ queries against an observable collection; Creating asynchronous operations with Rx; Chapter 9: Using Asynchronous I/O; Introduction; Working with files asynchronously.