diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-09-17 03:00:07 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-09-17 03:00:07 +0000 |
commit | fef792e47eab0ebe386c4bc7f61ac07c35d3fc50 (patch) | |
tree | 0f7617c3a1a10794e8c07db7d8ebe831e7e61c94 /src/log.c | |
parent | Releasing debian version 3.1.0+dfsg-5. (diff) | |
download | libyang3-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.c | 11 |
1 files changed, 8 insertions, 3 deletions
@@ -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; } |