Tervel  1.0.0
A collection of wait-free containers and algorithms.
mcas_API.h
Go to the documentation of this file.
1 #ifndef __mcas_buffer_h__
2 #define __mcas_buffer_h__
3 
4 #include <tervel/util/info.h>
6 #include <tervel/util/tervel.h>
7 
9 
10 template<class T>
11 class TestClass {
12  public:
13  TestClass(size_t capacity, size_t num_threads) {
14  tervel_obj = new tervel::Tervel(num_threads);
15  attach_thread();
17  };
18 
19  char * name() {
20  return "WF MCAS Buffer";
21  }
22 
23  void attach_thread() {
24  tervel::ThreadContext* thread_context __attribute__((unused));
25  thread_context = new tervel::ThreadContext(tervel_obj);
26  };
27 
28  void detach_thread() {
29  };
30 
31  bool enqueue(T val) {
32  return queue_->enqueue(val);
33  };
34 
35  bool dequeue(T &val) {
36  return queue_->dequeue(val);
37  };
38 
39  void print_queue() {
40  queue_->print_queue();
41  }
42 
43  private:
46 };
47 
48 #endif // __mcas_buffer_h__
void detach_thread()
Definition: mcas_API.h:28
std::atomic< T > * queue_
Definition: lock_API.h:76
Thread local information.
Definition: thread_context.h:62
tervel::containers::lf::mcas_buffer::RingBuffer< T > * queue_
Definition: mcas_API.h:45
TestClass(size_t capacity, size_t num_threads)
Definition: mcas_API.h:13
void print_queue()
Definition: mcas_API.h:39
bool dequeue(T &val)
Definition: mcas_API.h:35
bool enqueue(T val)
Definition: mcas_API.h:31
void attach_thread()
Definition: blank_api.h:40
Contains shared information that should be accessible by all threads.
Definition: tervel.h:39
Definition: blank_api.h:31
tervel::Tervel * tervel_obj
Definition: wf_hashmap_api.h:98
char * name()
Definition: mcas_API.h:19