Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions c10/util/Exception.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,12 @@ void Error::AppendMessage(const std::string& new_msg) {
namespace Warning {

namespace {
static WarningHandler base_warning_handler_ = WarningHandler();
static thread_local WarningHandler* warning_handler_ = &base_warning_handler_;
WarningHandler* getHandler() {
static WarningHandler base_warning_handler_ = WarningHandler();
return &base_warning_handler_;
};
static thread_local WarningHandler* warning_handler_ = getHandler();

}

void warn(SourceLocation source_location, const std::string& msg) {
Expand Down