Multithreading in Components
Multithreading, or free threading, refers to the ability of a program to execute multiple threads of operation simultaneously. An example of a multithreaded application might be a program that receives user input on one thread, performs a variety of complex calculations on a second thread, and updates a database on a third thread. In a single-threaded application, a user might spend idle time waiting for the calculations or database updates to finish. In a multithreaded application, these processes can proceed in the background so user time is not wasted.
Multithreading can be a powerful tool to use in component programming. By writing multithreaded components, you can create components that perform complex calculations in the background while leaving the user interface free to respond to user input.
Although multithreading can be a powerful tool, it can also be difficult to apply correctly. Improperly implemented multithreaded code can degrade application performance, or even cause frozen applications. The following topics will introduce you to some of the considerations and best practices for multithreaded programming.
In This Section
- Walkthrough: Authoring a Simple Multithreaded Component with Visual Basic
- Demonstrates creating a multithreaded component using Visual Basic.
- Walkthrough: Authoring a Simple Multithreaded Component with Visual C#
- Demonstrates creating a multithreaded component using Visual C#.
- Creating Threads
- Explains how to create a new thread of execution.
- Coordinating Multiple Threads of Execution
- Describes how to use locks to coordinate threads and ensure atomic execution of code.
- Thread-Safe Components
- Discusses what makes a component thread-safe and how to implement thread-safety in your components.
- Event Logs and Multithreaded Components
- Explains issues involved with using event logs with mutliple threads of execution.
- Logging Events for Multithreaded Components
- Describes how to coordinate using an EventLog component with multiple threads of operation.
- Manipulating Controls From Threads
- Explains the special considerations when manipulating controls with multiple threads.