The Threading Package
Introducing the Threading Package
The principle role of the Threading package is to allow you to create threads on a variety of operating systems and platforms. The Threading package includes:
*Thread management classes
The runnable family of classes allows you to create, control, and monitor threads of execution within your application. The synchronous runnable classes allow you to define work for existing threads of execution. The threaded runnable classes allow you to create new threads of execution for asynchronous activities.
*Thread server classes
The runnable server and runnable server pool classes are a ready-to-use solution for threading your application. These classes allow for creation of a single thread or a pool of threads that, once started, wait for your application to enqueue other runnable objects for execution. By using the functor-based runnable classes, your application can essentially queue any function for execution within a server. Runnables and runnable server classes are essential building-blocks for constructing active or thread-hot objects within your application.
*Thread-safe foundation mechanisms
The Threading package uses thread-safe smart-pointer classes (found in the Smart Pointer package) for thread-safe and exception-safe management of dynamically allocated resources. You can use the Thread-compatible Exception package family of store-and-forward exception classes to communicate error conditions across thread-boundaries.
*Resource management protection
The Threading package uses the handle-body idiom with thread-safe reference-counting for instance life-cycle management. This idiom helps to eliminate potential memory resource access errors and leaks, especially in the presence of C++ exceptions and multiple threads. Function pointers are the only raw pointers in the Threading package public interface.