Interthread Communication

We’ve examined some basic synchronization techniques, but they are not appropriate for every situation when you’re handling multiple threads. Let’s look at some additional techniques you can use for implementing more advanced cooperation and communication between threads.

Thread Notification

You’ve learned how to use the Monitor class to perform exclusive locking using a sync object. But consider a common scenario from the world of computer science: that of producers and consumers.

A producer is an object that creates resources. A consumer is an object that obtains resources from a producer. A simple producer might implement an iterative process, creating one resource after another. A consumer will wait until a resource ...

Get Microsoft® Visual J#™ .NET (Core Reference) 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.