Added support for SPDLOG_NO_ATOMIC_LEVELS in tweakme.h

This commit is contained in:
gabime
2016-04-10 01:37:11 +03:00
parent d0120b48c5
commit 974379c9be
6 changed files with 39 additions and 10 deletions

View File

@@ -7,7 +7,6 @@
#include <spdlog/logger.h>
#include <atomic>
#include <memory>
#include <string>

View File

@@ -5,7 +5,8 @@
#pragma once
// null, no cost mutex
#include <atomic>
// null, no cost dummy "mutex" and dummy "atomic" int
namespace spdlog
{
@@ -20,5 +21,25 @@ struct null_mutex
return true;
}
};
struct null_atomic_int
{
int value;
null_atomic_int() = default;
null_atomic_int(int val):value(val)
{}
int load(std::memory_order) const
{
return value;
}
void store(int val)
{
value = val;
}
};
}
}