speechd-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] bug fix initialize the module_stdout_mutex


From: Trevor Saunders
Subject: [PATCH] bug fix initialize the module_stdout_mutex
Date: Thu, 18 Nov 2010 08:22:40 -0500

This mutex was supposed to be initialized by the function
module_utils_init() however that function only called
pthread_mutex_init() on that mutex, and nobody ever called it.  We can
instead statically initialize the mutex with PTHREAD_MUTEX_INITIALIZER,
and get rid of module_utils_init()
---
 src/modules/module_utils.c |   11 ++---------
 src/modules/module_utils.h |    2 +-
 2 files changed, 3 insertions(+), 10 deletions(-)

diff --git a/src/modules/module_utils.c b/src/modules/module_utils.c
index 9fe907e..62d806e 100644
--- a/src/modules/module_utils.c
+++ b/src/modules/module_utils.c
@@ -33,6 +33,8 @@ static char* module_audio_pars[10];
 
 extern char* module_index_mark;
 
+pthread_mutex_t module_stdout_mutex = PTHREAD_MUTEX_INITIALIZER;
+
 char*
 do_message(SPDMessageType msgtype)
 {
@@ -1046,15 +1048,6 @@ add_config_option(configoption_t *options, int 
*num_config_options, char *name,
 }
 
 int
-module_utils_init(void)
-{
-    /* Init mutex */
-    pthread_mutex_init(&module_stdout_mutex, NULL);
-
-    return 0;
-}
-
-int
 module_audio_init_spd(char **status_info)
 {
     char *error=0;
diff --git a/src/modules/module_utils.h b/src/modules/module_utils.h
index e13d74b..d12862a 100644
--- a/src/modules/module_utils.h
+++ b/src/modules/module_utils.h
@@ -404,7 +404,7 @@ void module_report_event_pause(void);
 
 
 
-pthread_mutex_t module_stdout_mutex;
+extern pthread_mutex_t module_stdout_mutex;
 
 int module_utils_init(void);
 int module_audio_init_spd(char **status_info);
-- 
1.7.2.3




reply via email to

[Prev in Thread] Current Thread [Next in Thread]