October 2003
Intermediate to advanced
736 pages
15h 25m
English
The pi calculator example demonstrates how to perform long-running operations while still displaying a progress dialog and keeping the UI responsive to user interaction. Not only does it leverage multiple threads to split the UI from a long-running operation, but also the UI thread communicates further user input back to the worker thread to adjust its behavior. Although it could use shared data, the application uses a message passing scheme between threads to avoid the complications of synchronization.
.NET has extensive threading support, so techniques other than message passing can certainly be used to achieve the same ends. However, whatever method you choose, it's important to remember that a worker thread cannot call methods ...