ECC-1879: Cannot build with ENABLE_ECCODES_OMP_THREADS=ON: multiple definition of thread_init()

This commit is contained in:
shahramn 2024-10-25 11:55:28 +01:00
parent 8ed4d62e68
commit 3d1460d6f9
3 changed files with 9 additions and 9 deletions

View File

@ -16,7 +16,7 @@
static pthread_once_t once = PTHREAD_ONCE_INIT; static pthread_once_t once = PTHREAD_ONCE_INIT;
static pthread_mutex_t mutex1 = PTHREAD_MUTEX_INITIALIZER; static pthread_mutex_t mutex1 = PTHREAD_MUTEX_INITIALIZER;
static void thread_init() static void init_mutex()
{ {
pthread_mutexattr_t attr; pthread_mutexattr_t attr;
pthread_mutexattr_init(&attr); pthread_mutexattr_init(&attr);
@ -28,7 +28,7 @@ static void thread_init()
static int once = 0; static int once = 0;
static omp_nest_lock_t mutex1; static omp_nest_lock_t mutex1;
void thread_init() static void init_mutex()
{ {
GRIB_OMP_CRITICAL(lock_grib_accessor_class_bufr_elements_table_c) GRIB_OMP_CRITICAL(lock_grib_accessor_class_bufr_elements_table_c)
{ {
@ -90,7 +90,7 @@ static grib_trie* load_bufr_elements_table(grib_accessor* a, int* err)
if (self->localDir != NULL) if (self->localDir != NULL)
grib_get_string(h, self->localDir, localDir, &len); grib_get_string(h, self->localDir, localDir, &len);
GRIB_MUTEX_INIT_ONCE(&once, &thread_init); GRIB_MUTEX_INIT_ONCE(&once, &init_mutex);
GRIB_MUTEX_LOCK(&mutex1); GRIB_MUTEX_LOCK(&mutex1);
if (*masterDir != 0) { if (*masterDir != 0) {

View File

@ -20,7 +20,7 @@ grib_accessor_class* grib_accessor_class_codetable = &_grib_accessor_class_codet
static pthread_once_t once = PTHREAD_ONCE_INIT; static pthread_once_t once = PTHREAD_ONCE_INIT;
static pthread_mutex_t mutex1 = PTHREAD_MUTEX_INITIALIZER; static pthread_mutex_t mutex1 = PTHREAD_MUTEX_INITIALIZER;
void thread_init() static void init_mutex()
{ {
pthread_mutexattr_t attr; pthread_mutexattr_t attr;
pthread_mutexattr_init(&attr); pthread_mutexattr_init(&attr);
@ -32,7 +32,7 @@ void thread_init()
static int once = 0; static int once = 0;
static omp_nest_lock_t mutex1; static omp_nest_lock_t mutex1;
void thread_init() static void init_mutex()
{ {
GRIB_OMP_CRITICAL(lock_grib_accessor_class_codetable_c) GRIB_OMP_CRITICAL(lock_grib_accessor_class_codetable_c)
{ {
@ -205,7 +205,7 @@ static grib_codetable* load_table(grib_accessor* a)
localFilename = grib_context_full_defs_path(c, localRecomposed); localFilename = grib_context_full_defs_path(c, localRecomposed);
} }
GRIB_MUTEX_INIT_ONCE(&once, &thread_init); GRIB_MUTEX_INIT_ONCE(&once, &init_mutex);
GRIB_MUTEX_LOCK(&mutex1); /* GRIB-930 */ GRIB_MUTEX_LOCK(&mutex1); /* GRIB-930 */
/*printf("DBG %s: Look in cache: f=%s lf=%s (recomposed=%s)\n", self->att.name, filename, localFilename,recomposed);*/ /*printf("DBG %s: Look in cache: f=%s lf=%s (recomposed=%s)\n", self->att.name, filename, localFilename,recomposed);*/

View File

@ -18,7 +18,7 @@ grib_accessor_class* grib_accessor_class_smart_table = &_grib_accessor_class_sma
static pthread_once_t once = PTHREAD_ONCE_INIT; static pthread_once_t once = PTHREAD_ONCE_INIT;
static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
static void thread_init() static void init_mutex()
{ {
pthread_mutexattr_t attr; pthread_mutexattr_t attr;
pthread_mutexattr_init(&attr); pthread_mutexattr_init(&attr);
@ -30,7 +30,7 @@ static void thread_init()
static int once = 0; static int once = 0;
static omp_nest_lock_t mutex; static omp_nest_lock_t mutex;
void thread_init() static void init_mutex()
{ {
GRIB_OMP_CRITICAL(lock_grib_accessor_class_smart_table_c) GRIB_OMP_CRITICAL(lock_grib_accessor_class_smart_table_c)
{ {
@ -183,7 +183,7 @@ static int grib_load_smart_table(grib_context* c, const char* filename,
t->recomposed_name[0] = grib_context_strdup_persistent(c, recomposed_name); t->recomposed_name[0] = grib_context_strdup_persistent(c, recomposed_name);
t->next = c->smart_table; t->next = c->smart_table;
t->numberOfEntries = size; t->numberOfEntries = size;
GRIB_MUTEX_INIT_ONCE(&once, &thread_init); GRIB_MUTEX_INIT_ONCE(&once, &init_mutex);
GRIB_MUTEX_LOCK(&mutex); GRIB_MUTEX_LOCK(&mutex);
c->smart_table = t; c->smart_table = t;
GRIB_MUTEX_UNLOCK(&mutex); GRIB_MUTEX_UNLOCK(&mutex);