From 77c884d1257f9748a049402e7a85da8d82b31253 Mon Sep 17 00:00:00 2001
From: Santiago Ospina De Los Rios <sospinar@gmail.com>
Date: Tue, 7 Dec 2021 11:17:53 +0100
Subject: [PATCH] Remove data race introduced by ce_usage

This array introduces a data-race when the grid is read concurrently. Since it's one being used elsewhere in the library, we just remove it.
---
 dune/uggrid/gm/cw.cc | 17 -----------------
 1 file changed, 17 deletions(-)

diff --git a/dune/uggrid/gm/cw.cc b/dune/uggrid/gm/cw.cc
index 76dfd07e4..feb2824dd 100644
--- a/dune/uggrid/gm/cw.cc
+++ b/dune/uggrid/gm/cw.cc
@@ -90,14 +90,6 @@ typedef struct {
   INT objt_used;             /**< Bitwise object ID				*/
 } CONTROL_ENTRY_PREDEF;
 
-typedef struct {
-
-  INT read;             /**< Number of accesses to read		*/
-  INT write;            /**< Number of accesses to write		*/
-  INT max;              /**< Max value assigned to ce			*/
-
-} CE_USAGE;
-
 /****************************************************************************/
 /*                                                                          */
 /* definition of exported global variables                                  */
@@ -227,8 +219,6 @@ static CONTROL_ENTRY_PREDEF ce_predefines[MAX_CONTROL_ENTRIES] = {
   CE_INIT_UNUSED,
 };
 
-static CE_USAGE ce_usage[MAX_CONTROL_ENTRIES];
-
 /****************************************************************************/
 /** \brief Print all control entries of an objects control word
 
@@ -665,9 +655,6 @@ UINT NS_DIM_PREFIX ReadCW (const void *obj, INT ceID)
     assert(false);
   }
 
-  /* update statistics */
-  ce_usage[ceID].read++;
-
   ce = control_entries+ceID;
 
   if (!ce->used)
@@ -738,10 +725,6 @@ void NS_DIM_PREFIX WriteCW (void *obj, INT ceID, INT n)
     assert(false);
   }
 
-  /* update statistics */
-  ce_usage[ceID].write++;
-  ce_usage[ceID].max = MAX(n,ce_usage[ceID].max);
-
   ce = control_entries+ceID;
 
   if (!ce->used)
-- 
GitLab