Summary

We have covered a lot of ground in this chapter. We started by reviewing the difference between a CLR thread and an OS thread, and saw that the two concepts are not interchangeable and are represented by different, unrelated, .NET classes. Then we reviewed the different techniques available for writing multi-threaded applications in preparation for demonstrating these techniques in various samples. We started with a sample that demonstrated calling delegates asynchronously - the technique of choice for single methods that you wish to be executed on a different thread. This was followed by a discussion of the principles behind thread synchronization and the classes available to assist with synchronization. We then progressively developed our sample, adding to it first thread synchronization, then timers, and finished off by showing how to get one thread to abort a different thread cleanly - a technique which unfortunately can only be implemented if the worker thread has been created explicitly, instead of relying on the CLR thread pool.



Advanced  .NET Programming
Advanced .NET Programming
ISBN: 1861006292
EAN: 2147483647
Year: 2002
Pages: 124

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net