Tulip_SyncQ
Tulip_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 Tulip_SyncQ{
public:
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
Suvas Vajracharya