2019-06-04 05:09:16 +08:00
|
|
|
// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.
|
2018-04-18 07:04:10 +08:00
|
|
|
// Distributed under the MIT License (http://opensource.org/licenses/MIT)
|
2019-05-12 01:06:17 +08:00
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2018-07-14 21:21:53 +08:00
|
|
|
#include "spdlog/details/null_mutex.h"
|
|
|
|
#include <mutex>
|
|
|
|
|
2018-04-18 07:04:10 +08:00
|
|
|
namespace spdlog {
|
2018-04-20 18:20:19 +08:00
|
|
|
namespace details {
|
2018-04-18 07:04:10 +08:00
|
|
|
|
2018-07-14 21:21:53 +08:00
|
|
|
struct console_mutex
|
2018-04-20 18:20:19 +08:00
|
|
|
{
|
|
|
|
using mutex_t = std::mutex;
|
2018-07-14 21:21:53 +08:00
|
|
|
static mutex_t &mutex()
|
2018-04-20 18:20:19 +08:00
|
|
|
{
|
2018-07-14 21:21:53 +08:00
|
|
|
static mutex_t s_mutex;
|
|
|
|
return s_mutex;
|
2018-04-20 18:20:19 +08:00
|
|
|
}
|
|
|
|
};
|
2018-04-18 07:04:10 +08:00
|
|
|
|
2018-07-14 21:21:53 +08:00
|
|
|
struct console_nullmutex
|
2018-04-20 18:20:19 +08:00
|
|
|
{
|
|
|
|
using mutex_t = null_mutex;
|
2018-07-14 21:21:53 +08:00
|
|
|
static mutex_t &mutex()
|
2018-04-20 18:20:19 +08:00
|
|
|
{
|
2018-07-14 21:21:53 +08:00
|
|
|
static mutex_t s_mutex;
|
|
|
|
return s_mutex;
|
2018-04-20 18:20:19 +08:00
|
|
|
}
|
|
|
|
};
|
|
|
|
} // namespace details
|
|
|
|
} // namespace spdlog
|