Rogue Wave banner
Previous fileTop of DocumentContentsIndex pageNext file
Threads Module User's Guide
Rogue Wave web site:  Home Page  |  Main Documentation Page

5.6 The Producer-Consumer Classes

The Interthread Communication package includes a family of templatized, value and pointer-based, queue and stack classes that use producer-consumer synchronization semantics to coordinate multithread read and write operations.

By default, the size of the queue and stack structures defined by these classes is limited only by available memory. The constructors for these class can accept an artificial size limit if you want to block producers when the buffer is filled.

For information on the producer-consumer classes, see the Interthread Communication page on the Modules tab of the SourcePro C++ API Reference Guide.

For an example demonstrating the use of one of these classes, see Section 5.4.1.1, "The RWTPCValQueue Family of Classes."

5.6.1 Value and Pointer Classes

The concrete producer-consumer classes can be subdivided into groups according to their functionality. The following classes have simple producer-consumer synchronization semantics to support the exchange of data values or pointers:

5.6.2 Guarded and Prioritized Classes

The following classes have write operations that bind additional data items to each value prior to storing that value in the internal buffer. These additional data items, or decorations, vary by class and include a guard functor instance, a priority value, or both:

The guarded classes allow a separate guard functor to be associated with each value written into the buffer. The guard functor is used during read operations to determine whether the associated value is currently eligible for retrieval from the buffer.

The prioritized classes allow a separate priority value to be associated with each value written into the buffer. The priority value is used during the write operation to determine the associated value's insertion point within the buffer, such that the set of unread values is retrieved in priority order when read from the buffer.



Previous fileTop of DocumentContentsIndex pageNext file

Copyright © Rogue Wave Software, Inc. All Rights Reserved.

The Rogue Wave name and logo, and SourcePro, are registered trademarks of Rogue Wave Software. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.