speechd-discuss
[Top][All Lists]
Advanced

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

[PATCH 1/1] Remove unused function module_speak_thread_wfork()


From: Anatol
Subject: [PATCH 1/1] Remove unused function module_speak_thread_wfork()
Date: Mon, 26 Dec 2011 20:44:34 +0400

Remove function module_speak_thread_wfork() from module_utils.*.
Remove #include <semaphore.h> from module_utils.h.
---
 src/modules/module_utils.c |   72 --------------------------------------------
 src/modules/module_utils.h |   11 -------
 2 files changed, 0 insertions(+), 83 deletions(-)

diff --git a/src/modules/module_utils.c b/src/modules/module_utils.c
index de81c79..f8c3c7b 100644
--- a/src/modules/module_utils.c
+++ b/src/modules/module_utils.c
@@ -604,78 +604,6 @@ module_strip_punctuation_default(char *buf)
     module_strip_punctuation_some(buf, "~#$%^&*+=|<>[]_");
 }
 
-void
-module_speak_thread_wfork(sem_t *semaphore, pid_t *process_pid, 
-                          TChildFunction child_function,
-                          TParentFunction parent_function,
-                          int *speaking_flag, char **message, const 
SPDMessageType *msgtype,
-                          const size_t maxlen, const char *dividers, size_t 
*module_position,
-                          int *pause_requested)
-{
-    TModuleDoublePipe module_pipe;
-    int ret;
-    int status;
-
-    set_speaking_thread_parameters();
-
-    while(1){        
-        sem_wait(semaphore);
-        DBG("Semaphore on\n");
-
-        ret = pipe(module_pipe.pc);
-        if (ret != 0){
-            DBG("Can't create pipe pc\n");
-            *speaking_flag = 0;
-            continue;
-        }
-
-        ret = pipe(module_pipe.cp);
-        if (ret != 0){
-            DBG("Can't create pipe cp\n");
-            close(module_pipe.pc[0]);     close(module_pipe.pc[1]);
-            *speaking_flag = 0;
-            continue;
-        }
-
-       DBG("Pipes initialized");
-
-        /* Create a new process so that we could send it signals */
-        *process_pid = fork();
-
-        switch(*process_pid){
-        case -1:       
-            DBG("Can't say the message. fork() failed!\n");
-            close(module_pipe.pc[0]);     close(module_pipe.pc[1]);
-            close(module_pipe.cp[0]);     close(module_pipe.cp[1]);
-            *speaking_flag = 0;
-            continue;
-
-        case 0:
-            /* This is the child. Make it speak, but exit on SIGINT. */
-
-            DBG("Starting child...\n");
-            (* child_function)(module_pipe, maxlen);           
-            exit(0);
-
-        default:
-            /* This is the parent. Send data to the child. */
-
-            *module_position = (* parent_function)(module_pipe, *message, 
*msgtype,
-                                                   maxlen, dividers, 
pause_requested);
-
-            DBG("Waiting for child...");
-            waitpid(*process_pid, &status, 0);            
-            
-            *speaking_flag = 0;
-
-           module_report_event_end();
-
-            DBG("child terminated -: status:%d signal?:%d signal number:%d.\n",
-                WIFEXITED(status), WIFSIGNALED(status), WTERMSIG(status));
-        }        
-    }
-}
-
 size_t
 module_parent_wfork(TModuleDoublePipe dpipe, const char* message, 
SPDMessageType msgtype,
                     const size_t maxlen, const char* dividers, int 
*pause_requested)
diff --git a/src/modules/module_utils.h b/src/modules/module_utils.h
index 031692f..401c39f 100644
--- a/src/modules/module_utils.h
+++ b/src/modules/module_utils.h
@@ -24,7 +24,6 @@
 #ifndef __MODULE_UTILS_H
 #define __MODULE_UTILS_H
 
-#include <semaphore.h>
 #include <dotconf.h>
 #include <unistd.h>
 #include <stdio.h>
@@ -34,13 +33,11 @@
 #include <glib.h>
 #include <pthread.h>
 #include <signal.h>
-#include <semaphore.h>
 #include <sys/wait.h>
 #include <sys/time.h>
 #include <errno.h>
 #include <dotconf.h>
 
-#include <semaphore.h>
 #include <sys/ipc.h>
 
 #include <speechd_types.h>
@@ -209,14 +206,6 @@ typedef size_t(*TParentFunction) (TModuleDoublePipe dpipe, 
const char *message,
                                  const size_t maxlen, const char *dividers,
                                  int *pause_requested);
 
-void module_speak_thread_wfork(sem_t * semaphore, pid_t * process_pid,
-                              TChildFunction child_function,
-                              TParentFunction parent_function,
-                              int *speaking_flag, char **message,
-                              const SPDMessageType * msgtype,
-                              const size_t maxlen, const char *dividers,
-                              size_t * module_position, int *pause_requested);
-
 size_t module_parent_wfork(TModuleDoublePipe dpipe, const char *message,
                           SPDMessageType msgtype, const size_t maxlen,
                           const char *dividers, int *pause_requested);
-- 
1.7.4.1




reply via email to

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