Skip to content

Commit 04b6ed3

Browse files
committed
common UPDATE allow recursive ext_data_clb lock
1 parent fa87cc5 commit 04b6ed3

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/ly_common.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,7 @@ ly_ctx_shared_data_create(const struct ly_ctx *ctx, struct ly_ctx_shared_data **
339339
{
340340
LY_ERR rc = LY_SUCCESS;
341341
struct ly_ctx_shared_data **shrd_data = NULL;
342+
pthread_mutexattr_t attr;
342343

343344
if (shared_data) {
344345
*shared_data = NULL;
@@ -375,7 +376,10 @@ ly_ctx_shared_data_create(const struct ly_ctx *ctx, struct ly_ctx_shared_data **
375376
}
376377

377378
/* ext clb and leafref links locks */
378-
pthread_mutex_init(&(*shrd_data)->ext_clb_lock, NULL);
379+
pthread_mutexattr_init(&attr);
380+
pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
381+
pthread_mutex_init(&(*shrd_data)->ext_clb_lock, &attr);
382+
pthread_mutexattr_destroy(&attr);
379383
pthread_mutex_init(&(*shrd_data)->leafref_links_lock, NULL);
380384

381385
/* refcount */

0 commit comments

Comments
 (0)