Tervel  1.0.0
A collection of wait-free containers and algorithms.
tbb_API.h
Go to the documentation of this file.
1 #ifndef TBB_QUEUE_H
2 #define TBB_QUEUE_H
3 
4 #include "tbb/tbb.h"
5 
6 template<class T>
7 class TestClass {
8  public:
9  TestClass(size_t capacity, size_t num_threads) {
10  queue_ = new tbb::concurrent_bounded_queue<T>();
11  };
12 
13  char * name() {
14  return "TBB Bounded Queue";
15  }
16 
17  void attach_thread() {};
18 
19  void detach_thread() {};
20 
21  bool enqueue(T val) {
22  return queue_->try_push(val);
23  };
24  bool dequeue(T &val) {
25  return queue_->try_pop(val);
26  };
27 
28  private:
29  tbb::concurrent_bounded_queue<T> *queue_;
30 };
31 
32 
33 
34 #endif // TBB_QUEUE_H
void detach_thread()
Definition: tbb_API.h:19
std::atomic< T > * queue_
Definition: lock_API.h:76
TestClass(size_t capacity, size_t num_threads)
Definition: tbb_API.h:9
bool dequeue(T &val)
Definition: tbb_API.h:24
bool enqueue(T val)
Definition: tbb_API.h:21
void attach_thread()
Definition: tbb_API.h:17
Definition: blank_api.h:31
char * name()
Definition: tbb_API.h:13