Summary

This chapter presented multi-threaded applications in C#. The first section discussed how to create and start a thread, including declaring a thread argument and passing it a delegate with the method to be invoked, as well as executing the thread.

To keep threads from wreaking havoc with shared data, it's often necessary to use synchronization objects. Proper thread synchronization helps manage access to program data. The example program in this chapter used lock statements, providing a mutual exclusion access scenario to program data.

Multi-threading is common on server programs that create new threads to handle client requests. The next chapter, “Browsing the Network Libraries,” shows how to create clients and servers that communicate ...

Get C# Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.