lyb FEATURE thread-safe cached hash generation
diff --git a/src/context.c b/src/context.c
index 33d3f17..faa886a 100644
--- a/src/context.c
+++ b/src/context.c
@@ -236,6 +236,9 @@
/* initialize thread-specific keys */
while ((pthread_key_create(&ctx->errlist_key, ly_err_free)) == EAGAIN) {}
+ /* init LYB hash lock */
+ pthread_mutex_init(&ctx->lyb_hash_lock, NULL);
+
/* models list */
ctx->flags = options;
if (search_dir) {
@@ -1123,6 +1126,9 @@
/* dictionary */
lydict_clean(&ctx->dict);
+ /* LYB hash lock */
+ pthread_mutex_destroy(&ctx->lyb_hash_lock);
+
/* plugins - will be removed only if this is the last context */
lyplg_clean();