In the previous chapters, I’ve looked at low-level solutions to threading problems: locks of various sorts, timers, and so forth. This chapter moves on to discuss architectural solutions to threading problems. We’ll look at threads from the perspective of an OO designer, and at how to implement threads in an OO environment, focusing on the implementation of asynchronous methods. Along the way, I’ll look at another design pattern: Command—a means of implementing function pointers in an object-oriented way. I’ll also look at an architectural-level solution to the threading-complexity problem: namely the thread pool, which is useful for minimizing thread-creation overhead. Finally, I’ll demonstrate the practical application of a thread pool by showing you how to implement a server-side socket’s “accept” loop efficiently.
KeywordsAsynchronous Message Public Class Object Argument Spin Lock Thread Pool
Unable to display preview. Download preview PDF.