CUBRID Engine
latest
Main Page
Namespaces
Classes
Files
File List
File Members
lockfree_transaction_reclaimable.hpp
Go to the documentation of this file.
1
/*
2
* Copyright 2008 Search Solution Corporation
3
* Copyright 2016 CUBRID Corporation
4
*
5
* Licensed under the Apache License, Version 2.0 (the "License");
6
* you may not use this file except in compliance with the License.
7
* You may obtain a copy of the License at
8
*
9
* http://www.apache.org/licenses/LICENSE-2.0
10
*
11
* Unless required by applicable law or agreed to in writing, software
12
* distributed under the License is distributed on an "AS IS" BASIS,
13
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
* See the License for the specific language governing permissions and
15
* limitations under the License.
16
*
17
*/
18
19
//
20
// lock-free transaction reclaimable nodes
21
//
22
// Lock-free data structures needs to be tagged with a reclaimable node (by either derivation or composition).
23
// When node is to be removed from structure, it is retired, collected by thread's transaction descriptor and
24
// safely reclaimed later.
25
//
26
// See lockfree_transaction_system.hpp description for an overview of the lock-free transaction implementation.
27
//
28
29
#ifndef _LOCKFREE_TRANSACTION_RECLAIMABLE_HPP_
30
#define _LOCKFREE_TRANSACTION_RECLAIMABLE_HPP_
31
32
#include "
lockfree_transaction_def.hpp
"
33
34
namespace
lockfree
35
{
36
namespace
tran
37
{
38
class
descriptor;
39
}
// namespace tran
40
}
// namespace lockfree
41
42
namespace
lockfree
43
{
44
namespace
tran
45
{
46
class
reclaimable_node
47
{
48
public
:
49
reclaimable_node
()
50
: m_retired_next (
NULL
)
51
, m_retire_tranid (0)
52
{
53
}
54
virtual
~
reclaimable_node
() =
default
;
55
56
// override reclaim to change what happens with the reclaimable node
57
virtual
void
reclaim
()
58
{
59
// default is to delete itself
60
delete
this
;
61
}
62
63
protected
:
64
reclaimable_node
*
m_retired_next
;
// link to next retired node
65
// may be repurposed by derived classes
66
67
private
:
68
friend
descriptor
;
// descriptor can access next and transaction id
69
70
id
m_retire_tranid
;
71
};
72
}
// namespace tran
73
}
// namespace lockfree
74
75
#endif // !_LOCKFREE_TRANSACTION_RECLAIMABLE_HPP_
lockfree::tran::reclaimable_node::reclaimable_node
reclaimable_node()
Definition:
lockfree_transaction_reclaimable.hpp:49
lockfree::tran::reclaimable_node::m_retire_tranid
id m_retire_tranid
Definition:
lockfree_transaction_reclaimable.hpp:70
lockfree::tran::reclaimable_node::reclaim
virtual void reclaim()
Definition:
lockfree_transaction_reclaimable.hpp:57
NULL
#define NULL
Definition:
freelistheap.h:34
lockfree::tran::reclaimable_node::descriptor
friend descriptor
Definition:
lockfree_transaction_reclaimable.hpp:68
lockfree_transaction_def.hpp
lockfree::tran::reclaimable_node::m_retired_next
reclaimable_node * m_retired_next
Definition:
lockfree_transaction_reclaimable.hpp:64
lockfree::tran::reclaimable_node
Definition:
lockfree_transaction_reclaimable.hpp:46
lockfree
Definition:
lockfree_address_marker.hpp:29
src
base
lockfree_transaction_reclaimable.hpp
Generated by
1.8.11