Exemple #1
0
 /**
  * Signal the completion of an event. The value passed to this
  * method must be the same as the return value previously obtained
  * from the startEvent method. This method will signal the
  * completion of all pending barriers that were completed by the
  * completion of this event.
  *
  * @param token opaque token identifying the completed event
  **/
 void completeEvent(uint32_t token) {
     if (token == _token) {
         --_count;
         return;
     }
     --_queue.access(_queue.size() - (_token - token)).first;
     while (!_queue.empty() && _queue.front().first == 0) {
         _queue.front().second->completeBarrier();
         _queue.pop();
     }
 }
void print(const ArrayQueue<T> & q)
{
  cout << "capacity = " << q.capacity() << endl
       << "size     = " << q.size() << endl;

  for (int i = 0; i < q.size(); ++i)
    cout << (T) q.front(i) << " ";
  cout << endl ;

  for (int i = 0; i < q.size(); ++i)
    cout << (T) q.rear(i) << " ";
  cout << endl
       << endl;
}