CUBRID Engine
latest
Main Page
Namespaces
Classes
Files
File List
File Members
critical_section_tracker.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
* critical_section_tracker.hpp - interface to track and debug critical sections usage
21
*/
22
23
#ifndef _CRITICAL_SECTION_TRACKER_HPP_
24
#define _CRITICAL_SECTION_TRACKER_HPP_
25
26
#include "
critical_section.h
"
27
28
#include <cstdint>
29
30
namespace
cubsync
31
{
32
class
critical_section_tracker
33
{
34
public
:
35
36
critical_section_tracker
(
bool
enable =
false
);
37
38
static
const
std::size_t
MAX_REENTERS
= 8;
// how many re-enters do we allow?
39
40
void
start
(
void
);
41
void
stop
(
void
);
42
void
clear_all
(
void
);
43
44
void
on_enter_as_reader
(
int
cs_index);
45
void
on_enter_as_writer
(
int
cs_index);
46
void
on_promote
(
int
cs_index);
47
void
on_demote
(
int
cs_index);
48
void
on_exit
(
int
cs_index);
49
50
private
:
51
52
struct
cstrack_entry
53
{
54
std::uint8_t
m_enter_count
;
55
bool
m_is_writer
;
56
bool
m_is_demoted
;
57
58
cstrack_entry
();
59
};
60
61
bool
is_started
(
void
);
62
void
check
(
void
);
63
void
check_csect_interdependencies
(
int
cs_index);
64
65
cstrack_entry
m_cstrack_array
[
CRITICAL_SECTION_COUNT
];
66
bool
m_enabled
;
67
std::uint8_t
m_start_count
;
68
};
69
70
}
// namespace cubsync
71
72
#endif // _CRITICAL_SECTION_TRACKER_HPP_
cubsync::critical_section_tracker::is_started
bool is_started(void)
Definition:
critical_section_tracker.cpp:195
cubsync::critical_section_tracker::cstrack_entry
Definition:
critical_section_tracker.hpp:52
cubsync::critical_section_tracker::on_promote
void on_promote(int cs_index)
Definition:
critical_section_tracker.cpp:126
cubsync::critical_section_tracker::critical_section_tracker
critical_section_tracker(bool enable=false)
Definition:
critical_section_tracker.cpp:49
cubsync::critical_section_tracker
Definition:
critical_section_tracker.hpp:32
cubsync::critical_section_tracker::on_exit
void on_exit(int cs_index)
Definition:
critical_section_tracker.cpp:162
critical_section.h
cubsync::critical_section_tracker::m_start_count
std::uint8_t m_start_count
Definition:
critical_section_tracker.hpp:67
cubsync::critical_section_tracker::cstrack_entry::m_is_demoted
bool m_is_demoted
Definition:
critical_section_tracker.hpp:56
cubsync::critical_section_tracker::MAX_REENTERS
static const std::size_t MAX_REENTERS
Definition:
critical_section_tracker.hpp:38
cubsync::critical_section_tracker::cstrack_entry::cstrack_entry
cstrack_entry()
Definition:
critical_section_tracker.cpp:41
cubsync::critical_section_tracker::clear_all
void clear_all(void)
Definition:
critical_section_tracker.cpp:260
cubsync::critical_section_tracker::start
void start(void)
Definition:
critical_section_tracker.cpp:201
cubsync
Definition:
semaphore.hpp:29
cubsync::critical_section_tracker::stop
void stop(void)
Definition:
critical_section_tracker.cpp:211
cubsync::critical_section_tracker::on_demote
void on_demote(int cs_index)
Definition:
critical_section_tracker.cpp:144
cubsync::critical_section_tracker::check
void check(void)
Definition:
critical_section_tracker.cpp:235
cubsync::critical_section_tracker::on_enter_as_writer
void on_enter_as_writer(int cs_index)
Definition:
critical_section_tracker.cpp:99
cubsync::critical_section_tracker::cstrack_entry::m_is_writer
bool m_is_writer
Definition:
critical_section_tracker.hpp:55
cubsync::critical_section_tracker::on_enter_as_reader
void on_enter_as_reader(int cs_index)
Definition:
critical_section_tracker.cpp:58
CRITICAL_SECTION_COUNT
static const int CRITICAL_SECTION_COUNT
Definition:
critical_section.h:80
cubsync::critical_section_tracker::check_csect_interdependencies
void check_csect_interdependencies(int cs_index)
Definition:
critical_section_tracker.cpp:186
cubsync::critical_section_tracker::m_enabled
bool m_enabled
Definition:
critical_section_tracker.hpp:66
cubsync::critical_section_tracker::m_cstrack_array
cstrack_entry m_cstrack_array[CRITICAL_SECTION_COUNT]
Definition:
critical_section_tracker.hpp:65
cubsync::critical_section_tracker::cstrack_entry::m_enter_count
std::uint8_t m_enter_count
Definition:
critical_section_tracker.hpp:54
src
thread
critical_section_tracker.hpp
Generated by
1.8.11