Skip to content

Commit

Permalink
Fix race condition in cpp metric tests. (#9058)
Browse files Browse the repository at this point in the history
  • Loading branch information
trivialfis authored Apr 20, 2023
1 parent a5cd241 commit b908680
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/metric/elementwise_metric.cu
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ struct EvalError {
}
}
const char *Name() const {
static std::string name;
static thread_local std::string name;
if (has_param_) {
std::ostringstream os;
os << "error";
Expand Down Expand Up @@ -315,7 +315,7 @@ struct EvalTweedieNLogLik {
<< "tweedie variance power must be in interval [1, 2)";
}
const char *Name() const {
static std::string name;
static thread_local std::string name;
std::ostringstream os;
os << "tweedie-nloglik@" << rho_;
name = os.str();
Expand Down

0 comments on commit b908680

Please sign in to comment.