Multithreading, the Handle-Body Idiom, and the Secure Sockets Package
The Secure Sockets package is multithread-level-1 safe. All data structures used internally are protected by mutexes where appropriate. However, your application must protect the sharing of objects in your code. See Chapter 4, “The Synchronization Package,” in the Threads Module User’s Guide for more information about Rogue Wave synchronization objects.
The Secure Sockets package uses the handle-body idiom (see Chapter 7, “The Smart Pointer Package,” in the Threads Module User’s Guide). Most functions in the handle forward the call directly to the body. Calling the copy constructor or assignment operator on a handle object simply makes a copy of that handle, which points to the same body as the original. If these two handles are in different threads, you must use a mutex or another synchronization primitive to prevent multiple threads from simultaneously accessing the body.
The following classes use the handle-body idiom:
Class
RWSecureSocketPackageInit uses a reference count that is not protected against multiple threads accessing or changing it. This class is used to initialize the Secure Sockets package, and is normally instantiated by the main thread well before any other threads exist. Multiple threads should never need to access instances of this class.