mirror of
https://github.com/gabime/spdlog.git
synced 2025-11-16 09:28:56 +08:00
global mutex stdout stderr sinks
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <thread>
|
||||
#include <mutex>
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
@@ -474,6 +475,19 @@ inline bool in_terminal(FILE *file)
|
||||
return isatty(fileno(file)) != 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
// stdout/stderr global mutexes
|
||||
inline std::mutex& stdout_mutex()
|
||||
{
|
||||
static std::mutex &mutex = std::mutex{};
|
||||
return mutex;
|
||||
}
|
||||
|
||||
inline std::mutex& stderr_mutex()
|
||||
{
|
||||
static std::mutex &mutex = std::mutex{};
|
||||
return mutex;
|
||||
}
|
||||
} // namespace os
|
||||
} // namespace details
|
||||
} // namespace spdlog
|
||||
|
||||
Reference in New Issue
Block a user