Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
spdlog
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
spdlog
Commits
799ba2a5
Commit
799ba2a5
authored
Nov 26, 2017
by
gabime
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added SPDLOG_DISABLE_TID_CACHING macro to prevent invalid thread ids after fork
parent
adbc2209
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
8 deletions
+18
-8
include/spdlog/details/os.h
include/spdlog/details/os.h
+5
-5
include/spdlog/tweakme.h
include/spdlog/tweakme.h
+13
-3
No files found.
include/spdlog/details/os.h
View file @
799ba2a5
...
...
@@ -316,7 +316,7 @@ inline int utc_minutes_offset(const std::tm& tm = details::os::localtime())
}
//Return current thread id as size_t
//It exists because the std::this_thread::get_id() is much slower(espcially under VS 2013)
//It exists because the std::this_thread::get_id() is much slower(esp
e
cially under VS 2013)
inline
size_t
_thread_id
()
{
#ifdef _WIN32
...
...
@@ -342,15 +342,15 @@ inline size_t _thread_id()
//Return current thread id as size_t (from thread local storage)
inline
size_t
thread_id
()
{
#if defined(
_MSC_VER) && (_MSC_VER < 1900) || defined(__clang__) && !__has_feature(cxx_thread_local
)
#if defined(
SPDLOG_DISABLE_TID_CACHING) || (defined(_MSC_VER) && (_MSC_VER < 1900)) || (defined(__clang__) && !__has_feature(cxx_thread_local)
)
return
_thread_id
();
#else
#else
// cache thread id in tls
static
thread_local
const
size_t
tid
=
_thread_id
();
return
tid
;
#endif
}
}
// wchar support for windows file names (SPDLOG_WCHAR_FILENAMES must be defined)
...
...
@@ -424,7 +424,7 @@ inline int pid()
}
// Detrmine if the terminal supports colors
// Det
e
rmine if the terminal supports colors
// Source: https://github.com/agauniyal/rang/
inline
bool
is_color_terminal
()
{
...
...
include/spdlog/tweakme.h
View file @
799ba2a5
...
...
@@ -23,7 +23,7 @@
///////////////////////////////////////////////////////////////////////////////
// Uncomment if date/time logging is not needed and never appear in the log pattern.
// This will prevent spdlog from quering the clock on each log call.
// This will prevent spdlog from quer
y
ing the clock on each log call.
//
// WARNING: If the log pattern contains any date/time while this flag is on, the result is undefined.
// You must set new pattern(spdlog::set_pattern(..") without any date/time in it
...
...
@@ -34,7 +34,7 @@
///////////////////////////////////////////////////////////////////////////////
// Uncomment if thread id logging is not needed (i.e. no %t in the log pattern).
// This will prevent spdlog from quering the thread id on each log call.
// This will prevent spdlog from quer
y
ing the thread id on each log call.
//
// WARNING: If the log pattern contains thread id (i.e, %t) while this flag is on, the result is undefined.
//
...
...
@@ -42,6 +42,16 @@
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
// Uncomment to prevent spdlog from caching thread ids in thread local storage.
// By default spdlog saves thread ids in tls to gain a few micros for each call.
//
// WARNING: if your program forks, UNCOMMENT this flag to prevent undefined thread ids in the children logs.
//
// #define SPDLOG_DISABLE_TID_CACHING
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
// Uncomment if logger name logging is not needed.
// This will prevent spdlog from copying the logger name on each log call.
...
...
@@ -59,7 +69,7 @@
///////////////////////////////////////////////////////////////////////////////
// Uncomment to avoid locking in the registry operations (spdlog::get(), spdlog::drop() spdlog::register()).
// Use only if your code never modifes concurrently the registry.
// Use only if your code never modif
i
es concurrently the registry.
// Note that upon creating a logger the registry is modified by spdlog..
//
// #define SPDLOG_NO_REGISTRY_MUTEX
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment