Skip to content

Instantly share code, notes, and snippets.

@0x1mason
Created July 25, 2017 00:54
Show Gist options
  • Save 0x1mason/c24c2c8bdd2dca0f09986ffd119bc8d4 to your computer and use it in GitHub Desktop.
Save 0x1mason/c24c2c8bdd2dca0f09986ffd119bc8d4 to your computer and use it in GitHub Desktop.
omp lock patch
diff --git a/grib_api/src/grib_context.c b/grib_api/src/grib_context.c
index ecfd1a5..384f005 100644
--- a/grib_api/src/grib_context.c
+++ b/grib_api/src/grib_context.c
@@ -341,6 +341,8 @@ static grib_context default_grib_context = {
0 /* classes */
#if GRIB_PTHREADS
,PTHREAD_MUTEX_INITIALIZER /* mutex */
+#elif GRIB_OMP_THREADS
+ ,0 /* omp_nest_lock_t */
#endif
};
@@ -462,6 +464,9 @@ grib_context* grib_context_get_default()
&(default_grib_context.concepts_count));
default_grib_context.def_files=grib_trie_new(&(default_grib_context));
default_grib_context.classes=grib_trie_new(&(default_grib_context));
+#if GRIB_OMP_THREADS
+ omp_init_nest_lock(&default_grib_context.mutex);
+#endif
}
GRIB_MUTEX_UNLOCK(&mutex_c);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment