Skip to content

Commit

Permalink
Merge pull request #261 from ken-matsui/make-thread-local-optional
Browse files Browse the repository at this point in the history
Make thread_local for color_mode optional
  • Loading branch information
ToruNiina committed Jul 24, 2024
2 parents 83843fd + 696335a commit 35ac3d1
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion include/toml11/fwd/color_fwd.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@
#define TOML11_ERROR_MESSAGE_COLORIZED false
#endif

#ifdef TOML11_USE_THREAD_LOCAL_COLORIZATION
#define TOML11_THREAD_LOCAL_COLORIZATION thread_local
#else
#define TOML11_THREAD_LOCAL_COLORIZATION
#endif

namespace toml
{
namespace color
Expand Down Expand Up @@ -44,7 +50,7 @@ class color_mode

inline color_mode& color_status() noexcept
{
static thread_local color_mode status;
static TOML11_THREAD_LOCAL_COLORIZATION color_mode status;
return status;
}

Expand Down

0 comments on commit 35ac3d1

Please sign in to comment.