Fix race condition in cpp metric tests. (#9058)

This commit is contained in:
Jiaming Yuan 2023-04-21 05:24:10 +08:00 committed by GitHub
parent a5cd2412de
commit b908680bec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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";
@ -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();