-
Notifications
You must be signed in to change notification settings - Fork 1
/
atomic_list.cpp
56 lines (46 loc) · 1.32 KB
/
atomic_list.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#include "atomic_list.hpp"
#include "large_block_list.hpp"
#include "node_pool.hpp"
#include "stub_list.hpp"
namespace otf_gc
{
template <typename T>
node_pool<atomic_list<T>>& atomic_list_pool()
{
static thread_local node_pool<atomic_list<T>> pool;
return pool;
}
template <typename T>
node_pool<list<T>>& list_pool()
{
static thread_local node_pool<list<T>> pool;
return pool;
}
template <typename T>
void* list<T>::node_type::operator new(std::size_t)
{
return list_pool<T>().get();
}
template <typename T>
void list<T>::node_type::operator delete(void* ptr, std::size_t)
{
list_pool<T>().put(ptr);
}
template <typename T>
void* atomic_list<T>::node_type::operator new(std::size_t)
{
return atomic_list_pool<T>().get();
}
template <typename T>
void atomic_list<T>::node_type::operator delete(void* ptr, std::size_t)
{
atomic_list_pool<T>().put(ptr);
}
template class list<void*>;
template class atomic_list<list<void*>>;
template class atomic_list<stub_list>;
template node_pool<list<void*>>& list_pool<void*>();
template node_pool<list<list<void*>>>& list_pool<list<void*>>();
template node_pool<atomic_list<list<void*>>>& atomic_list_pool<list<void*>>();
template node_pool<atomic_list<stub_list>>& atomic_list_pool<stub_list>();
}