From dd2875f3513d84373f4aa4654ae439c4109b22b2 Mon Sep 17 00:00:00 2001 From: Eugen Betke Date: Mon, 13 Jan 2025 18:10:26 +0100 Subject: [PATCH] Modernisation: Action: Fix data race --- src/action/action.cc | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/action/action.cc b/src/action/action.cc index 047bf7957..4c7a4e881 100644 --- a/src/action/action.cc +++ b/src/action/action.cc @@ -124,10 +124,11 @@ static void init_mutex() int grib_create_accessor(grib_section* p, grib_action* a, grib_loader* h) { /* ECC-604: Do not lock excessively */ - /*GRIB_MUTEX_INIT_ONCE(&once,&init_mutex);*/ - /*GRIB_MUTEX_LOCK(&mutex1);*/ - return a->create_accessor(p, h); - /*GRIB_MUTEX_UNLOCK(&mutex1);*/ + GRIB_MUTEX_INIT_ONCE(&once,&init_mutex); + GRIB_MUTEX_LOCK(&mutex1); + auto accessor = a->create_accessor(p, h); + GRIB_MUTEX_UNLOCK(&mutex1); + return accessor; } // int grib_action_notify_change(grib_action* a, grib_accessor* observer, grib_accessor* observed)