ret = tts_dbus_request_finalize(client->uid);
if (0 != ret) {
SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Fail to request finalize");
- }
+ }
+ g_is_daemon_started = false;
case TTS_STATE_CREATED:
/* Free resources */
tts_client_destroy(tts);
if (0 != ret) {
SLOG(LOG_WARN, TAG_TTSC, "[ERROR] Fail to request finalize");
}
+ g_is_daemon_started = false;
client->before_state = client->current_state;
client->current_state = TTS_STATE_CREATED;
return FALSE;
}
-
-static void __my_sig_child(int signo, siginfo_t *info, void *data)
-{
- int status;
- pid_t child_pid, child_pgid;
-
- child_pgid = getpgid(info->si_pid);
- SLOG(LOG_DEBUG, TAG_TTSC, "Signal handler: dead pid = %d, pgid = %d", info->si_pid, child_pgid);
-
- while (0 < (child_pid = waitpid(-1, &status, WNOHANG))) {
- if(child_pid == child_pgid)
- killpg(child_pgid, SIGKILL);
- }
-
- return;
-}
-
static int __tts_check_tts_daemon()
{
- if (TRUE == _tts_is_alive())
+ if (TRUE == _tts_is_alive()) {
return 0;
+ }
/* fork-exec tts-daemom */
int pid, i;
- struct sigaction act, dummy;
-
- act.sa_handler = NULL;
- act.sa_sigaction = __my_sig_child;
- sigemptyset(&act.sa_mask);
- act.sa_flags = SA_NOCLDSTOP | SA_SIGINFO;
-
- if (sigaction(SIGCHLD, &act, &dummy) < 0) {
- SLOG(LOG_ERROR, TAG_TTSC, "Cannot make a signal handler");
- return -1;
- }
pid = fork();
return TTS_SETTING_ERROR_OPERATION_FAILED;
}
-
+ g_is_daemon_started = false;
+
if (0 != tts_setting_dbus_close_connection()) {
SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Fail to close connection\n ");
} else {
}
-static void __setting_my_sig_child(int signo, siginfo_t *info, void *data)
-{
- int status;
- pid_t child_pid, child_pgid;
-
- child_pgid = getpgid(info->si_pid);
- SLOG(LOG_DEBUG, TAG_TTSC, "Signal handler: dead pid = %d, pgid = %d", info->si_pid, child_pgid);
-
- while ((child_pid = waitpid(-1, &status, WNOHANG)) > 0) {
- if(child_pid == child_pgid)
- killpg(child_pgid, SIGKILL);
- }
-
- return;
-}
-
static int __check_setting_tts_daemon()
{
if( TRUE == __tts_setting_is_alive() )
/* fork-exec tts-daemom */
int pid, i;
- struct sigaction act, dummy;
-
- act.sa_handler = NULL;
- act.sa_sigaction = __setting_my_sig_child;
- sigemptyset(&act.sa_mask);
- act.sa_flags = SA_NOCLDSTOP | SA_SIGINFO;
-
- if (sigaction(SIGCHLD, &act, &dummy) < 0) {
- SLOG(LOG_ERROR, TAG_TTSC, "Cannot make a signal handler");
- return -1;
- }
pid = fork();
+tts (0.1.1-44slp2+1) unstable; urgency=low
+
+ * Fix PLM issue(P130121-3243)
+ * Add Daemon termination
+
+ -- Kwangyoun Kim <ky85.kim@samsung.com> Thu, 24 Jan 2013 18:08:17 +0900
+
tts (0.1.1-43slp2+1) unstable; urgency=low
* Change License and notice file
if (g_list_length(g_engine_list) > 0) {
/* Get a first item */
iter = g_list_first(g_engine_list);
-
while (NULL != iter) {
/* Get data from item */
data = iter->data;
- dlclose(data->handle);
-
iter = g_list_remove(iter, data);
}
}
-
g_list_free(iter);
-
/* release current engine data */
if (g_cur_engine.pefuncs != NULL)
g_free(g_cur_engine.pefuncs);
printf("TTS-Daemon Start...\n");
ecore_main_loop_begin();
-
- ecore_shutdown();
+ SLOG(LOG_DEBUG, TAG_TTSD, "===== TTS DAEMON FINALIZE");
+
ttsd_dbus_close_connection();
ttsd_network_finalize();
+ ecore_shutdown();
+
+ SLOG(LOG_DEBUG, TAG_TTSD, "=====");
+ SLOG(LOG_DEBUG, TAG_TTSD, " ");
+ SLOG(LOG_DEBUG, TAG_TTSD, " ");
+
return 0;
}
return TTSD_ERROR_NONE;
}
+static Eina_Bool __quit_ecore_loop(void *data)
+{
+ ecore_main_loop_quit();
+ SLOG(LOG_DEBUG, TAG_TTSD, "[Server] quit ecore main loop");
+ return EINA_FALSE;
+}
int ttsd_server_finalize(int uid)
{
/* unload engine, if ref count of client is 0 */
if (0 == ttsd_data_get_client_count()) {
- if (0 != ttsd_engine_agent_unload_current_engine()) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Server ERROR] fail to unload current engine ");
+ if (0 != ttsd_engine_agent_release()) {
+ SLOG(LOG_ERROR, TAG_TTSD, "[Server ERROR] fail to release engine agent");
} else {
- SLOG(LOG_DEBUG, TAG_TTSD, "[Server SUCCESS] unload current engine ");
+ SLOG(LOG_DEBUG, TAG_TTSD, "[Server SUCCESS] release engine agent");
}
+
+ ecore_timer_add(0, __quit_ecore_loop, NULL);
}
return TTSD_ERROR_NONE;
/* unload engine, if ref count of client is 0 */
if (0 == ttsd_data_get_client_count())
{
- if (0 != ttsd_engine_agent_unload_current_engine())
- SLOG(LOG_ERROR, TAG_TTSD, "[Server Setting ERROR] fail to unload current engine ");
- else
- SLOG(LOG_DEBUG, TAG_TTSD, "[Server Setting SUCCESS] unload current engine ");
+ if (0 != ttsd_engine_agent_release()) {
+ SLOG(LOG_ERROR, TAG_TTSD, "[Server Setting ERROR] Fail to release engine agent");
+ } else {
+ SLOG(LOG_DEBUG, TAG_TTSD, "[Server Setting SUCCESS] Release engine agent");
+ }
+ ecore_timer_add(0, __quit_ecore_loop, NULL);
}
return TTSD_ERROR_NONE;