In Brief

  • The Thread class is the means by which developers for the .NET Compact Framework implement multithreaded applications.

  • Creating and starting a thread and putting a thread to sleep is done in much the same way on the .NET Compact Framework as it is on the desktop .NET Framework.

  • There are special issues with suspending threads and quitting threaded applications on the .NET Compact Framework that require special attention from developers.

  • Threads may not update user interface controls that they don't own, or they will likely lock up the application. The ControlInvoker class is an elegant work-around to this problem.

  • The Mutex class provides a means for suspending and resuming threads, and it provides the infrastructure needed to simulate the Thread.Join() method, which is not available on the .NET Compact Framework.

  • The Monitor class provides another model for controlling threads that is a good fit for controlling access to individual data objects by multiple threads.

  • The ThreadPool class provides a convenient means for developers to use many short-lived threads efficiently, not wasting resources.

  • Timers are supported by both C# and Visual Basic. They provide a handy way to regularly execute small amounts of code but are not suitable for regularly performing computationally intensive or heavily blocking algorithms.

  • The Interlocked class is used to increment a variable, decrement a variable, or exchange values between variables as an atomic operation.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.128.173.53