Thread Pools Technology Sample
[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]
This sample demonstrates the use of the ThreadPool class. The sample queues up an asynchronous method call that is executed by a thread from the thread pool managed by the common language runtime.
For more information about using the samples, see the following topics:
To build the sample using the command prompt
Open a Command Prompt window and navigate to one of the language-specific subdirectories for the sample.
Type msbuild PoolsCS.sln or msbuild PoolsVB.sln, depending on your choice of programming language, at the command line.
To build the sample using Visual Studio
Open Windows Explorer and navigate to one of the language-specific subdirectories for the sample.
Double-click the icon for PoolsCS.sln or PoolsVB.sln, depending on your choice of programming language, to open the file in Visual Studio.
On the Build menu, click Build Solution.
To run the sample
Navigate to the directory that contains the built executable file, using the command prompt.
Type AsyncMethod.exe at the command line.
This sample builds a console application. You must start it from the command prompt in order to view its output.
This sample uses queuing to manage asynchronous method calls. The called method "does some work" and then sets an event indicating that the work has finished. The main thread waits on the event and then exits.
The following bullets briefly describe the classes and technologies used by this sample:
Review comments in the source code files for more information on thread synchronization.