summaryrefslogtreecommitdiffstats
path: root/src/log.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-09-17 03:00:07 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-09-17 03:00:07 +0000
commitfef792e47eab0ebe386c4bc7f61ac07c35d3fc50 (patch)
tree0f7617c3a1a10794e8c07db7d8ebe831e7e61c94 /src/log.c
parentReleasing debian version 3.1.0+dfsg-5. (diff)
downloadlibyang3-fef792e47eab0ebe386c4bc7f61ac07c35d3fc50.tar.xz
libyang3-fef792e47eab0ebe386c4bc7f61ac07c35d3fc50.zip
Merging upstream version 3.4.2+dfsg.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/log.c')
-rw-r--r--src/log.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/log.c b/src/log.c
index 9bb4b19..9cb60b3 100644
--- a/src/log.c
+++ b/src/log.c
@@ -189,10 +189,15 @@ ly_err_get_rec(const struct ly_ctx *ctx)
/* prepare record */
rec.tid = pthread_self();
+ /* reuse lock */
+ /* LOCK */
+ pthread_mutex_lock((pthread_mutex_t *)&ctx->lyb_hash_lock);
+
/* get the pointer to the matching record */
- if (lyht_find(ctx->err_ht, &rec, lyht_hash((void *)&rec.tid, sizeof rec.tid), (void **)&match)) {
- return NULL;
- }
+ lyht_find(ctx->err_ht, &rec, lyht_hash((void *)&rec.tid, sizeof rec.tid), (void **)&match);
+
+ /* UNLOCK */
+ pthread_mutex_unlock((pthread_mutex_t *)&ctx->lyb_hash_lock);
return match;
}