Change static variables accessed concurrently to thread_local (#4980)

This commit is contained in:
Takuro Sato 2023-02-09 15:27:25 +00:00 коммит произвёл GitHub
Родитель a44759fbc6
Коммит eac45b5c4c
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 2 добавлений и 2 удалений

Просмотреть файл

@ -57,7 +57,7 @@ namespace crypto
private: private:
static int get_drng_support() static int get_drng_support()
{ {
static int drng_features = -1; thread_local int drng_features = -1;
/* So we don't call cpuid multiple times for the same information */ /* So we don't call cpuid multiple times for the same information */
if (drng_features == -1) if (drng_features == -1)

Просмотреть файл

@ -26,7 +26,7 @@ namespace ccf::pal
static bool is_intel_cpu() static bool is_intel_cpu()
{ {
static int intel_cpu = -1; thread_local int intel_cpu = -1;
if (intel_cpu == -1) if (intel_cpu == -1)
{ {