tbb::deprecated::concurrent_queue<T,Alloc> テンプレート・クラス

概要

並列操作を含むキュー用のテンプレート・クラス。 これは、インテル スレッディング・ビルディング・ブロック (インテル TBB) 2.1 以前でサポートされていた concurrent_queue です。 新しいコードは、インテル® TBB 2.2 の無制限の concurrent_queue または concurrent_bounded_queue を使用してください。

構文

template<typename T, typename Alloc=cache_aligned_allocator<T> > class concurrent_queue;

ヘッダー

#include "tbb/concurrent_queue.h"

説明

tbb::deprecated::concurrent_queue は、複数のスレッドが項目のプッシュとポップを同時に行うことができる境界付きの FIFO (先入れ先出し) データ構造です。 デフォルトの境界はキューを実際に無制限にできるほど十分な大きさですが、対象のマシン上のメモリー制限に従います。

ヒント

tbb::deprecated::concurrent_queuetbb 名前空間に挿入するには、TBB_DEPRECATED=1 を指定してコンパイルします。 最終的には、新しい queue クラスに移行することを検討してください。

  • キューの変更に非ブロック操作 (pushtry_pop) のみ必要な場合は tbb::concurrent_queue を使用します。

  • その他の場合は、新しい tbb::concurrent_bounded_queue を使用します。 ブロック操作 (pushtry_pop) と非ブロック操作の両方がサポートされます。

どちらの場合も、次の表の新しいメソッド名を使用してください。

並列操作を含むキュー用のメソッド名の変更

tbb::deprecated::concurrent_queue のメソッド

tbb::concurrent_queue または tbb::concurrent_bounded_queue の等価なメソッド

pop_if_present

try_pop

push_if_not_full

try_push (tbb::concurrent_queue では利用できません)

begin

unsafe_begin

end

unsafe_end

メンバー

namespace tbb {
 namespace deprecated {
 template<typename T,
 typename Alloc=cache_aligned_allocator<T> >
 class concurrent_queue {
 public:
 // 型
 typedef T value_type;
 typedef T& reference;
 typedef const T& const_reference;
 typedef std::ptrdiff_t size_type;
 typedef std::ptrdiff_t difference_type;
 concurrent_queue(const Alloc& a = Alloc());
 concurrent_queue(const concurrent_queue& src,
 const Alloc& a = Alloc());
 template<typename InputIterator>
 concurrent_queue(InputIterator first, InputIterator last,
 const Alloc& a = Alloc());
 ~concurrent_queue();
 void push(const T& source);
 bool push_if_not_full(const T& source);
 void pop(T& destination);
 bool pop_if_present(T& destination);
 void clear();
 size_type size() const;
 bool empty() const;
 size_t capacity() const;
 void set_capacity(size_type capacity);
 Alloc get_allocator() const;
 typedef implementation-defined iterator;
 typedef implementation-defined const_iterator;
 // イテレーター (低速、デバッグ用)
 iterator begin();
 iterator end();
 const_iterator begin() const;
 const_iterator end() const;
 };
 }
 #if TBB_DEPRECATED
 using deprecated::concurrent_queue;
 #else
 using strict_ppl::concurrent_queue;
 #endif
 }