From 48941bfe3449a4d789f49b2b068db5f55829946d Mon Sep 17 00:00:00 2001 From: Martin Mares Date: Mon, 1 Nov 2010 20:18:27 +0100 Subject: [PATCH] Threads: The master mutex was not initialized in some cases --- ucw/threads.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ucw/threads.c b/ucw/threads.c index f0c70140..0cc958f6 100644 --- a/ucw/threads.c +++ b/ucw/threads.c @@ -67,6 +67,12 @@ ucwlib_tid(void) /*** Thread context ***/ +static void CONSTRUCTOR +ucwlib_threads_init_master(void) +{ + pthread_mutex_init(&ucwlib_master_mutex, NULL); +} + #ifdef CONFIG_UCW_TLS __thread struct ucwlib_context ucwlib_context; @@ -94,7 +100,6 @@ ucwlib_threads_init(void) { if (pthread_key_create(&ucwlib_context_key, ucwlib_free_thread_context) < 0) die("Cannot create pthread_key: %m"); - pthread_mutex_init(&ucwlib_master_mutex, NULL); } struct ucwlib_context * -- 2.39.5