Chapter 15. Multithreading
This chapter discusses how to write multithreaded code. To do this, you delve into the System.Threading namespace that contains the API for manipulating threads. In addition, the chapter introduces a C# keyword tha...
Running and Controlling a Separate Thread
Chapter 14 discussed delegates and events. Programming multiple threads with C# depends heavily on the syntax of delegates. In order to start a new thread, it is necessary to call a delegate that contain...
Passing Parameters to Threads
The code in Listing 15.2 was relatively simple. A significant missing item was to pass data from the main thread to the second thread. In C# 1.0, this was cumbersome because the THRead constructor could handle only th...
Thread Pooling
Regardless of the number of processors, excess threads affect performance. System.Threading.ThreadPool manages threads, including the reuse of expired threads, based on resources.
Accessing threads in ThreadPool is similar to expli...
Unhandled Exceptions
To catch all exceptions from a thread, you surround the initial thread start method with a try/catch/finally block, just as you would for all code within Main(). However, what happens if a third-party component creates an alte...
Synchronization
Running a new thread is a relatively simple programming task. What makes multithreaded programming difficult, however, is recognizing the data that multiple threads could access simultaneously. The program needs to synchronize su...
Summary
This chapter delved into the details surrounding the creation and manipulation of threads. In addition to introducing the framework-related classes and the lock keyword, this chapter gave an overview of what makes multithreaded programming...
AJAX popular information C# language guides Windows books and cookbooks
.......
С 2009 года мы стали переводить структура сайта на различные языки. Сайт теперь будет содержать книги не только на английском языке, но также и на других европейских языках, в том числе и на Русском языке.