This chapter describes the thread communication mechanisms of Threads.h++:
IOUs
A function performs some operation that produces a result or value, and then returns that result to the function's caller. Normal function invocations are synchronous, but they can also be asynchronous-they return to their caller before their associated operation has finished.
In the Interthread Communication package, asynchronous operations are possible through the use of IOUs, a communication mechanism that represents a future result of an operation. A function that launches an asynchronous operation can immediately return an IOU instance that is bound to the future result of that operation. This IOU instance can be redeemed at anytime, by any thread, to retrieve the result of the operation. If the operation has not yet completed, then the redeeming thread is blocked until a result has been produced.
For more information, see Section 5.5.5, "Using IOUs," and Section 5.5, "The IOU Classes."
Producer-Consumer Queues
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 access. Producer-consumer synchronization insures that a thread attempting to read from an empty buffer blocks until an entry is available, and that a thread attempting to write to a size-limited buffer that is full, blocks until an entry is removed or read by another thread.
For more information, see Section 5.4.1, "Using Producer-Consumer Queues," and Section 5.6, "The Producer-Consumer Classes."
The Interthread Communication package depends on the Thread-compatible Exception, Execution Tracing, Synchronization, Smart Pointer, and Functor packages of Threads.h++.
The rw\itc directory contains a header file for each class in the Interthread Communication package. The header files are named classname.h. You can also access the declarations for the entire package through itc.h, an umbrella file that includes the header files for all the classes.
©Copyright 2000, Rogue Wave Software, Inc.
Contact Rogue Wave about documentation or support issues.