Chapter 3

Threading and the Asynchronous Pattern





Pre-requirement for codes compilation:

  1. Windows XP Pro SP2.

  2. Visual Studio Community (previously Express) Edition – free.

  3. Visual Studio Component Community (previously Express) Edition – VB .NET, C#, VC++ etc. - free.

  4. .NET Framework 3.5.

  5. Some of the program examples in this chapter are Windows Form/WinForm applications in C++/CLI, C# and VB .NET.

  6. Before you start this Chapter, you may want to learn and understand the Win32 Thread, Process and Synchronization that implemented on the Windows platform.

  7. The general Visual C++ .NET/C++-CLI programming tutorial which includes WinForm can be found at Visual C++ .NET programming tutorial.


What do we have in this chapter?

  1. An Overview

  2. Threading

    Creating a Thread

    C++ Thread Program Example

    C# Thread Program Example

    VB .NET Thread Program Example

  3. Controlling a Thread

  4. Abort()

    Suspend(), Interrupt(), and Resume()

    Finishing a Thread

    Windows Forms I/O Problem Using Threading

    C++ WinForm Program Example

  5. C# WinForm Program Example

  6. VB .NET WinForm Program Example

  7. Using Thread Pools

  8. Using Events to Synchronize Threads

    Designing Critical Sections in Your Code



    C++ Critical Section Program Example

  9. C# Critical Section Program Example

  10. VB .NET Critical Section Program Example

  11. Asynchronous Pattern

  12. C++ Asynchronous I/O Program Example

  13. C# Asynchronous I/O Program Example

  14. VB .NET Asynchronous I/O Program Example

  15. C++ Thread and Network I/O Program Example

  16. C# Thread and Network I/O Program Example

  17. VB .NET Thread and Network I/O Program Example





This chapter will introduce two important concepts useful in network programming: threading and the asynchronous pattern. These asynchronous programming techniques allow you to design more flexible applications so that you can do multiple things at the same time in one application. This flexibility is important because you can develop a networking application that can service a user interface while it processes I/O on a network, which makes the user experience much better. Many of the remaining chapter discussions and samples will use these asynchronous programming techniques.









Custom Search
< Managed I/O: Streams, Readers, and Writers | Part 1 | Part 2 | Part 3 | Part 4 | Part 5 | Part 6 | Part 7 | Part 8 | Part 9 | Part 10 | Serialization >