Custom Threading

So far, you’ve seen a number of ways to get asynchronous support for free from .NET. These techniques are ideal for making simple asynchronous calls to improve performance or to start a potentially time-consuming task without stalling the application. However, they are of much less help if you need to create intelligent, thread-aware code that communicates with other threads, runs for a long time to perform a variety of tasks, and allows variable levels of prioritization. To handle these cases, you need to take complete control of threading by using the System.Threading.Thread class and creating your own threaded objects.

To create a separate thread of execution in .NET, you create a new Thread object, identify the code it should ...

Get Microsoft® .NET Distributed Applications: Integrating XML Web Services and .NET Remoting 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.