HPCxx_SyncQ

HPCxx_SyncQ<T> provides a dual "queue" of values of type T. Any attempt to read a sync variable before it is written will cause the reading thread to suspend until a value has been assigned. The thread waiting will "take the value" from the queue and continue executing. Waiting threads are also queued. The ith thread in the queue will receive the ith value written to the sync variable.

There are several other standard methods for SyncQ<T>.

Class Definition

     
template<class T>;
class HPCxx_SyncQ{
    public:
       operator T();    // read a value
       operator =(T &); // assign a value
       void read(T &);  // another form of read
       void write(T &); // another form of writing
       int length();    // the number of values in the queue

       // wait until the value is there and then
       // read the value but do not remove it from
       // the queue. The next waiting thread is signaled.
       void waitAndCopy(T& data); 
       bool peek(T &);  // same as Sync<>
       
}
    

Examples
hpc++@extreme.indiana.edu

Last modified: Thu Apr 22 00:22:44 EST 1999