Concurrency in C# Cookbook

By Stephen Cleary

if you are one of many many builders doubtful approximately concurrent and multithreaded improvement, this functional cookbook will swap your brain. With greater than seventy five code-rich recipes, writer Stephen Cleary demonstrates parallel processing and asynchronous programming strategies, utilizing libraries and language beneficial properties in .Net 4.5 and C# 5.0.

Concurrency is changing into extra universal in responsive and scalable software improvement, yet it’s been super tough to code. The distinct strategies during this cookbook convey you ways smooth instruments increase the extent of abstraction, making concurrency a lot more straightforward than sooner than. entire with ready-to-use code and discussions approximately how and why the answer works, you get recipes for using:

  • async and await for asynchronous operations
  • Parallel programming with the duty Parallel Library
  • The Tpl Dataflow library for developing dataflow pipelines
  • Capabilities that Reactive Extensions construct on most sensible of Linq
  • Unit checking out with concurrent code
  • Interop situations for combining concurrent approaches
  • Immutable, threadsafe, and producer/consumer collections
  • Cancellation help on your concurrent code
  • Asynchronous-friendly Object-Oriented Programming
  • Thread synchronization for having access to data

Show description

Preview of Concurrency in C# Cookbook PDF

Similar Programming books

Joe Celko's SQL for Smarties: Advanced SQL Programming Third Edition (The Morgan Kaufmann Series in Data Management Systems)

SQL for Smarties was once hailed because the first ebook committed explicitly to the complicated concepts had to rework an skilled SQL programmer into knowledgeable. Now, 10 years later and within the 3rd version, this vintage nonetheless reigns excellent because the e-book written by means of an SQL grasp that teaches destiny SQL masters.

Designing Audio Effect Plug-Ins in C++: With Digital Audio Signal Processing Theory

Not only one other theory-heavy electronic sign processing publication, nor one other uninteresting build-a-generic-database programming publication, Designing Audio impact Plug-Ins in C++ offers every thing you every little thing you must comprehend to do exactly that, together with totally labored, downloadable code for dozens audio impact plug-ins and virtually provided algorithms.

Effective C++: 55 Specific Ways to Improve Your Programs and Designs (3rd Edition)

“Every C++ expert wishes a replica of potent C++. it's an absolute must-read for an individual contemplating doing severe C++ improvement. If you’ve by no means learn potent C++ and also you imagine you recognize every thing approximately C++, reconsider. ”— Steve Schirripa, software program Engineer, Google “C++ and the C++ group have grown up within the final fifteen years, and the 3rd version of potent C++ displays this.

Cocoa Design Patterns

“Next time a few child indicates up at my door requesting a code overview, this can be the publication that i'm going to throw at him. ”   –Aaron Hillegass, founding father of huge Nerd Ranch, Inc. , and writer of Cocoa Programming for Mac OS X   Unlocking the secrets and techniques of Cocoa and Its Object-Oriented Frameworks   Mac and iPhone builders are frequently crushed through the breadth and class of the Cocoa frameworks.

Additional info for Concurrency in C# Cookbook

Show sample text content

Fifty five five. 1. changing . web occasions five. 2. Sending Notifications to a Context five. three. Grouping occasion info with home windows and Buffers five. four. Taming occasion Streams with Throttling and Sampling five. five. Timeouts fifty six fifty eight 60 sixty two sixty four 6. checking out. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . sixty seven 6. 1. Unit trying out async tools 6. 2. Unit checking out async equipment anticipated to Fail 6. three. Unit checking out async void equipment 6. four. Unit trying out Dataflow Meshes 6. five. Unit checking out Rx Observables 6. 6. Unit checking out Rx Observables with Faked Scheduling sixty eight sixty nine seventy one seventy two seventy four seventy six 7. Interop. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . eighty one 7. 1. Async Wrappers for “Async” equipment with “Completed” occasions 7. 2. Async Wrappers for “Begin/End” tools 7. three. Async Wrappers for whatever 7. four. Async Wrappers for Parallel Code 7. five. Async Wrappers for Rx Observables 7. 6. Rx Observable Wrappers for async Code 7. 7. Rx Observables and Dataflow Meshes eighty one eighty three eighty four 86 87 88 ninety eight. Collections. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ninety three eight. 1. Immutable Stacks and Queues eight. 2. Immutable Lists eight. three. Immutable units eight. four. Immutable Dictionaries eight. five. Threadsafe Dictionaries eight. 6. blocking off Queues eight. 7. blockading Stacks and luggage eight. eight. Asynchronous Queues iv | desk of Contents www. it-ebooks. details ninety six ninety eight a hundred 102 104 106 108 one hundred ten 8. nine. Asynchronous Stacks and luggage eight. 10. Blocking/Asynchronous Queues 113 a hundred and fifteen nine. Cancellation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119 nine. 1. Issuing Cancellation Requests nine. 2. Responding to Cancellation Requests through Polling nine. three. Canceling because of Timeouts nine. four. Canceling async Code nine. five. Canceling Parallel Code nine. 6. Canceling Reactive Code nine. 7. Canceling Dataflow Meshes nine. eight. Injecting Cancellation Requests nine. nine. Interop with different Cancellation structures a hundred and twenty 123 124 one hundred twenty five 126 128 a hundred thirty 131 132 10. Functional-Friendly OOP. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . a hundred thirty five 10. 1. Async Interfaces and Inheritance 10. 2. Async building: Factories 10. three. Async building: The Asynchronous Initialization trend 10. four. Async homes 10. five. Async occasions 10. 6. Async Disposal one hundred thirty five 137 139 142 a hundred forty five 148 eleven. Synchronization. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153 eleven. 1. blocking off Locks eleven. 2. Async Locks eleven. three. blocking off signs eleven. four. Async signs eleven. five. Throttling 158 one hundred sixty 162 163 a hundred sixty five 12. Scheduling. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167 12. 1. Scheduling paintings to the Thread Pool 12. 2. Executing Code with a job Scheduler 12. three. Scheduling Parallel Code 12. four. Dataflow Synchronization utilizing Schedulers 167 169 171 172 thirteen. eventualities. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173 thirteen. 1. Initializing Shared assets thirteen. 2. Rx Deferred evaluate thirteen. three. Asynchronous facts Binding thirteen. four. Implicit kingdom 173 one hundred seventy five 176 178 Index. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181 desk of Contents www. it-ebooks. information | v www. it-ebooks. information Preface i feel the animal in this hide, a standard palm civet, is appropriate to the topic of this booklet.

Download PDF sample

Rated 4.07 of 5 – based on 38 votes