More parallel patterns
If you have to write multithreaded code, patterns are definitely the way to go. By implementing the most complicated parts of the infrastructure internally, they help you focus on the important part—the problem-specific code. The number of patterns in the Delphi RTL is, however, quite limited, so it doesn’t hurt if you also know about other parallel programming libraries. In Chapter 10, More Parallel Patterns, we looked at patterns implemented in the open source parallel programming framework OmniThreadLibrary (OTL).
OTL implements multithreading support on two levels. Low-level multithreading support brings TThread
-based multithreading to the modern age by adding communication support, timers, and more. It also allows you to write a thread code as a collection of small event handlers instead of as a big monolithic main loop. In a way, this is similar to how Delphi VCL replaced writing a big main loop that processed all kinds of Windows events...