Tervel  1.0.0
A collection of wait-free containers and algorithms.
tsigas_API.h
Go to the documentation of this file.
1 #ifndef __TSIGAS_BUFFER_H__
2 #define __TSIGAS_BUFFER_H__
3 
4 #include <cds/container/tsigas_cycle_queue.h>
5 #include <cds/init.h> // for cds::Initialize and cds::Terminate
6 #include <cds/gc/hp.h> // for cds::HP (Hazard Pointer) garbage collector
7 
8 #define USING_CDS_LIB 1
9 
10 template<class T>
11 class TestClass {
12  public:
13  TestClass(size_t capacity, size_t num_threads) {
14  queue_ = new TQueue(capacity);
15  };
16 
17  char * name() {
18  return "CDS Tsiagas Cycle Queue";
19  }
20 
21  void attach_thread() {
22  cds::threading::Manager::attachThread();
23  };
24 
25  void detach_thread() {
26  cds::threading::Manager::detachThread();
27  };
28 
29  bool enqueue(T val) {
30  return queue_->enqueue(val);
31  };
32  bool dequeue(T &val) {
33  return queue_->dequeue(val);
34  };
35 
36  private:
37  typedef cds::container::TsigasCycleQueue<T,
38  cds::opt::buffer< cds::opt::v::dynamic_buffer<T> > > TQueue;
39  TQueue *queue_;
40 };
41 
42 #endif // __TSIGAS_BUFFER_H__
void detach_thread()
Definition: tsigas_API.h:25
std::atomic< T > * queue_
Definition: lock_API.h:76
TQueue * queue_
Definition: tsigas_API.h:39
TestClass(size_t capacity, size_t num_threads)
Definition: tsigas_API.h:13
bool dequeue(T &val)
Definition: tsigas_API.h:32
bool enqueue(T val)
Definition: tsigas_API.h:29
void attach_thread()
Definition: tsigas_API.h:21
cds::container::TsigasCycleQueue< T, cds::opt::buffer< cds::opt::v::dynamic_buffer< T > > > TQueue
Definition: tsigas_API.h:34
Definition: blank_api.h:31
char * name()
Definition: tsigas_API.h:17