Merge branch 'gabime:v1.x' into feature-source_location

pull/2690/head
M. Galib Uludag 2 years ago committed by GitHub
commit cdc2cec437
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -62,6 +62,10 @@
#endif // unix
#if defined __APPLE__
# include <AvailabilityMacros.h>
#endif
#ifndef __has_feature // Clang - feature checking macros.
# define __has_feature(x) 0 // Compatibility with non-clang compilers.
#endif
@ -355,7 +359,19 @@ SPDLOG_INLINE size_t _thread_id() SPDLOG_NOEXCEPT
return static_cast<size_t>(::thr_self());
#elif __APPLE__
uint64_t tid;
// There is no pthread_threadid_np prior to 10.6, and it is not supported on any PPC,
// including 10.6.8 Rosetta. __POWERPC__ is Apple-specific define encompassing ppc and ppc64.
# if (MAC_OS_X_VERSION_MAX_ALLOWED < 1060) || defined(__POWERPC__)
tid = pthread_mach_thread_np(pthread_self());
# elif MAC_OS_X_VERSION_MIN_REQUIRED < 1060
if (&pthread_threadid_np) {
pthread_threadid_np(nullptr, &tid);
} else {
tid = pthread_mach_thread_np(pthread_self());
}
# else
pthread_threadid_np(nullptr, &tid);
# endif
return static_cast<size_t>(tid);
#else // Default to standard C++11 (other Unix)
return static_cast<size_t>(std::hash<std::thread::id>()(std::this_thread::get_id()));

@ -219,8 +219,9 @@ SPDLOG_INLINE void registry::flush_all()
SPDLOG_INLINE void registry::drop(const std::string &logger_name)
{
std::lock_guard<std::mutex> lock(logger_map_mutex_);
auto is_default_logger = default_logger_ && default_logger_->name() == logger_name;
loggers_.erase(logger_name);
if (default_logger_ && default_logger_->name() == logger_name)
if (is_default_logger)
{
default_logger_.reset();
}

Loading…
Cancel
Save