You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
spdlog/include/spdlog/details/null_mutex.h

46 lines
582 B
C

10 years ago
//
// Copyright(c) 2015 Gabi Melman.
// Distributed under the MIT License (http://opensource.org/licenses/MIT)
//
11 years ago
11 years ago
#pragma once
#include <atomic>
// null, no cost dummy "mutex" and dummy "atomic" int
11 years ago
11 years ago
namespace spdlog
{
namespace details
{
11 years ago
struct null_mutex
{
11 years ago
void lock() {}
void unlock() {}
bool try_lock()
{
return true;
}
11 years ago
};
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;
}
};
11 years ago
}
}