Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
spdlog
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
spdlog
Commits
1857a44c
Commit
1857a44c
authored
Sep 07, 2019
by
gabime
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix #1215
parent
bd9e1475
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
8 deletions
+16
-8
include/spdlog/common.h
include/spdlog/common.h
+1
-0
include/spdlog/details/null_mutex.h
include/spdlog/details/null_mutex.h
+15
-8
No files found.
include/spdlog/common.h
View file @
1857a44c
...
...
@@ -4,6 +4,7 @@
#pragma once
#include "spdlog/tweakme.h"
#include "spdlog/details/null_mutex.h"
#include <atomic>
#include <chrono>
...
...
include/spdlog/details/null_mutex.h
View file @
1857a44c
...
...
@@ -4,15 +4,16 @@
#pragma once
#include <atomic>
#include <utility>
// null, no cost dummy "mutex" and dummy "atomic" int
namespace
spdlog
{
namespace
details
{
struct
null_mutex
{
void
lock
()
{}
void
unlock
()
{}
bool
try_lock
()
void
lock
()
const
{}
void
unlock
()
const
{}
bool
try_lock
()
const
{
return
true
;
}
...
...
@@ -23,18 +24,24 @@ struct null_atomic_int
int
value
;
null_atomic_int
()
=
default
;
explicit
null_atomic_int
(
int
val
)
:
value
(
val
)
explicit
null_atomic_int
(
int
new_value
)
:
value
(
new_value
)
{}
int
load
(
std
::
memory_order
)
const
int
load
(
std
::
memory_order
=
std
::
memory_order_relaxed
)
const
{
return
value
;
}
void
store
(
int
val
)
void
store
(
int
new_value
,
std
::
memory_order
=
std
::
memory_order_relaxed
)
{
value
=
val
;
value
=
new_value
;
}
int
exchange
(
int
new_value
,
std
::
memory_order
=
std
::
memory_order_relaxed
)
{
std
::
swap
(
new_value
,
value
);
return
new_value
;
// return value before the call
}
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment