Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
condenser
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
hive
condenser
Commits
f1d63fb5
Commit
f1d63fb5
authored
8 years ago
by
theoreticalbts
Browse files
Options
Downloads
Patches
Plain Diff
Allow lock checks to be enabled at runtime (disabled by default)
parent
3c3e51a9
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
include/chainbase/chainbase.hpp
+5
-2
5 additions, 2 deletions
include/chainbase/chainbase.hpp
src/chainbase.cpp
+5
-0
5 additions, 0 deletions
src/chainbase.cpp
with
10 additions
and
2 deletions
include/chainbase/chainbase.hpp
+
5
−
2
View file @
f1d63fb5
...
...
@@ -14,6 +14,7 @@
#include
<boost/multi_index_container.hpp>
#include
<boost/chrono.hpp>
#include
<boost/config.hpp>
#include
<boost/filesystem.hpp>
#include
<boost/lexical_cast.hpp>
#include
<boost/thread.hpp>
...
...
@@ -638,18 +639,19 @@ namespace chainbase {
void
close
();
void
flush
();
void
wipe
(
const
bfs
::
path
&
dir
);
void
set_require_locking
(
bool
enable_require_locking
);
void
require_lock_fail
(
const
char
*
lock_type
)
const
;
void
require_read_lock
()
const
{
if
(
_read_only
&&
(
_read_lock_count
<=
0
)
)
if
(
_enable_require_locking
&&
_read_only
&&
(
_read_lock_count
<=
0
)
)
require_lock_fail
(
"read"
);
}
void
require_write_lock
()
{
if
(
_write_lock_count
<=
0
)
if
(
_enable_require_locking
&&
(
_write_lock_count
<=
0
)
)
require_lock_fail
(
"write"
);
}
...
...
@@ -918,6 +920,7 @@ namespace chainbase {
int32_t
_read_lock_count
=
0
;
int32_t
_write_lock_count
=
0
;
bool
_enable_require_locking
=
false
;
};
template
<
typename
Object
,
typename
...
Args
>
...
...
This diff is collapsed.
Click to expand it.
src/chainbase.cpp
+
5
−
0
View file @
f1d63fb5
...
...
@@ -130,6 +130,11 @@ namespace chainbase {
_index_map
.
clear
();
}
void
database
::
set_require_locking
(
bool
enable_require_locking
)
{
_enable_require_locking
=
enable_require_locking
;
}
void
database
::
require_lock_fail
(
const
char
*
lock_type
)
const
{
std
::
string
err_msg
=
"require_"
+
std
::
string
(
lock_type
)
+
"_lock() failed"
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment