From 2eadb25487671b338ab30f8a139f14cb5014b42c Mon Sep 17 00:00:00 2001 From: Dariusz Sciebura Date: Thu, 21 Nov 2024 07:48:56 +0000 Subject: [PATCH] Fix datarace by making the common resource log_prefix thread local Signed-off-by: Dariusz Sciebura --- include/ofi.h | 2 +- src/common.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/ofi.h b/include/ofi.h index 9661a7553d9..6239a6b1f3c 100644 --- a/include/ofi.h +++ b/include/ofi.h @@ -320,7 +320,7 @@ struct ofi_filter { extern struct ofi_filter prov_log_filter; extern struct fi_provider core_prov; -extern const char *log_prefix; +extern _Thread_local const char *log_prefix; void ofi_create_filter(struct ofi_filter *filter, const char *env_name); void ofi_free_filter(struct ofi_filter *filter); diff --git a/src/common.c b/src/common.c index 0d641ac74a1..4ae2d411afd 100644 --- a/src/common.c +++ b/src/common.c @@ -2429,4 +2429,4 @@ size_t ofi_vrb_speed(uint8_t speed, uint8_t width) } /* log_prefix is used by fi_log and by prov/util */ -const char *log_prefix = ""; +_Thread_local const char *log_prefix = "";