Create pid file when espeakup is really ready

This makes sure that we do not report that we are ready until everything
is initialized.
This commit is contained in:
Samuel Thibault 2016-03-10 08:10:30 -06:00 committed by William Hubbs
commit c1ad891f2e

View file

@ -98,15 +98,9 @@ int main(int argc, char **argv)
return 1;
}
/*
* If we are not in debug mode, daemonize and store the pid.
*/
/* Daemonize if we are not in debug mode. */
if (!debug) {
daemon(0, 1);
if (create_pid_file() < 0) {
perror("Unable to create pid file");
return 2;
}
}
}
@ -153,6 +147,14 @@ int main(int argc, char **argv)
return 4;
}
/* Store the pid */
if (!debug && espeakup_mode == ESPEAKUP_MODE_SPEAKUP) {
if (create_pid_file() < 0) {
perror("Unable to create pid file");
return 2;
}
}
/* wait for the threads to shut down. */
pthread_join(signal_thread_id, NULL);
pthread_join(softsynth_thread_id, NULL);