move console_globals to inline header

pull/1156/head
taiyu 6 years ago
parent a7ba6e447d
commit 54089dcbbb

@ -0,0 +1,26 @@
// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.
// Distributed under the MIT License (http://opensource.org/licenses/MIT)
#pragma once
#include "spdlog/common.h"
#include "spdlog/details/console_globals.h"
namespace spdlog {
namespace details {
SPDLOG_INLINE console_mutex::mutex_t &console_mutex::mutex()
{
static mutex_t s_mutex;
return s_mutex;
}
SPDLOG_INLINE console_nullmutex::mutex_t &console_nullmutex::mutex()
{
static mutex_t s_mutex;
return s_mutex;
}
} // namespace details
} // namespace spdlog

@ -12,21 +12,17 @@ namespace details {
struct console_mutex
{
using mutex_t = std::mutex;
static mutex_t &mutex()
{
static mutex_t s_mutex;
return s_mutex;
}
static mutex_t &mutex();
};
struct console_nullmutex
{
using mutex_t = null_mutex;
static mutex_t &mutex()
{
static mutex_t s_mutex;
return s_mutex;
}
static mutex_t &mutex();
};
} // namespace details
} // namespace spdlog
#ifdef SPDLOG_HEADER_ONLY
#include "console_globals-inl.h"
#endif

@ -34,6 +34,7 @@ template class spdlog::sinks::rotating_file_sink<std::mutex>;
template class spdlog::sinks::rotating_file_sink<spdlog::details::null_mutex>;
#include "spdlog/details/registry-inl.h"
#include "spdlog/details/console_globals-inl.h"
#include "spdlog/details/os-inl.h"
#include "spdlog/details/periodic_worker-inl.h"

Loading…
Cancel
Save