Tervel
1.0.0
A collection of wait-free containers and algorithms.
Main Page
Namespaces
Classes
Files
File List
File Members
tervel
tests
ring-buffer
api
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
>
5
#include <
tervel/util/thread_context.h
>
6
#include <
tervel/util/tervel.h
>
7
8
#include <
tervel/containers/lf/mcas-buffer/mcas_buffer.h
>
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
();
16
queue_
=
new
tervel::containers::lf::mcas_buffer::RingBuffer<T>
(capacity);
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
:
44
tervel::Tervel
*
tervel_obj
;
45
tervel::containers::lf::mcas_buffer::RingBuffer<T>
*
queue_
;
46
};
47
48
#endif // __mcas_buffer_h__
TestClass::detach_thread
void detach_thread()
Definition:
mcas_API.h:28
TestClass::queue_
std::atomic< T > * queue_
Definition:
lock_API.h:76
tervel::ThreadContext
Thread local information.
Definition:
thread_context.h:62
thread_context.h
mcas_buffer.h
TestClass::queue_
tervel::containers::lf::mcas_buffer::RingBuffer< T > * queue_
Definition:
mcas_API.h:45
TestClass::TestClass
TestClass(size_t capacity, size_t num_threads)
Definition:
mcas_API.h:13
TestClass::print_queue
void print_queue()
Definition:
mcas_API.h:39
TestClass::dequeue
bool dequeue(T &val)
Definition:
mcas_API.h:35
TestClass::enqueue
bool enqueue(T val)
Definition:
mcas_API.h:31
TestClass::attach_thread
void attach_thread()
Definition:
blank_api.h:40
tervel.h
info.h
tervel::Tervel
Contains shared information that should be accessible by all threads.
Definition:
tervel.h:39
tervel::containers::lf::mcas_buffer::RingBuffer
Definition:
mcas_buffer.h:72
TestClass
Definition:
blank_api.h:31
TestClass::tervel_obj
tervel::Tervel * tervel_obj
Definition:
wf_hashmap_api.h:98
TestClass::name
char * name()
Definition:
mcas_API.h:19
Generated on Mon May 4 2015 20:55:11 for Tervel by
1.8.9.1