termux-packages/packages/speechd/speechd.patch

105 lines
3.9 KiB
Diff
Raw Normal View History

2021-08-06 18:12:03 +02:00
diff -u -r ../speechd-0.10.2/src/api/c/libspeechd.c ./src/api/c/libspeechd.c
--- ../speechd-0.10.2/src/api/c/libspeechd.c 2020-11-24 23:38:03.000000000 +0000
+++ ./src/api/c/libspeechd.c 2021-04-05 18:06:21.834517140 +0000
@@ -608,7 +608,7 @@
pthread_mutex_lock(&connection->ssip_mutex);
if (connection->mode == SPD_MODE_THREADED) {
- pthread_cancel(connection->td->events_thread);
+ pthread_kill(connection->td->events_thread, 0);
pthread_mutex_destroy(&connection->td->mutex_reply_ready);
pthread_mutex_destroy(&connection->td->mutex_reply_ack);
pthread_cond_destroy(&connection->td->cond_reply_ready);
diff -u -r ../speechd-0.10.2/src/audio/nas.c ./src/audio/nas.c
--- ../speechd-0.10.2/src/audio/nas.c 2020-11-24 23:38:03.000000000 +0000
+++ ./src/audio/nas.c 2021-04-05 18:06:21.834517140 +0000
@@ -51,7 +51,6 @@
static void *_nas_handle_events(void *par)
{
spd_nas_id_t *nas_id = (spd_nas_id_t *) par;
- pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
while (1)
AuHandleEvents(nas_id->aud);
@@ -209,7 +208,7 @@
if (nas_id == NULL)
return -2;
- pthread_cancel(nas_id->nas_event_handler);
+ pthread_kill(nas_id->nas_event_handler, 0);
pthread_join(nas_id->nas_event_handler, NULL);
pthread_mutex_destroy(&nas_id->pt_mutex);
diff -u -r ../speechd-0.10.2/src/modules/baratinoo.c ./src/modules/baratinoo.c
--- ../speechd-0.10.2/src/modules/baratinoo.c 2020-11-24 23:38:03.000000000 +0000
+++ ./src/modules/baratinoo.c 2021-04-05 18:06:21.834517140 +0000
@@ -561,7 +561,7 @@
g_usleep(25000);
/* Make sure the thread has really exited */
- pthread_cancel(engine->thread);
+ pthread_kill(engine->thread, 0);
DBG(DBG_MODNAME "Joining threads.");
if (pthread_join(engine->thread, NULL) != 0)
DBG(DBG_MODNAME "Failed to join threads.");
diff -u -r ../speechd-0.10.2/src/modules/module_utils.c ./src/modules/module_utils.c
--- ../speechd-0.10.2/src/modules/module_utils.c 2020-11-24 23:38:03.000000000 +0000
+++ ./src/modules/module_utils.c 2021-04-05 18:06:21.834517140 +0000
@@ -891,15 +891,17 @@
DBG("Can't fill signal set, expect problems when terminating!\n");
}
+#ifndef __ANDROID__
pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL);
+#endif
}
int module_terminate_thread(pthread_t thread)
{
int ret;
- ret = pthread_cancel(thread);
+ ret = pthread_kill(thread, 0);
if (ret != 0) {
DBG("Cancellation of speak thread failed");
return 1;
diff -u -r ../speechd-0.10.2/src/server/speaking.c ./src/server/speaking.c
--- ../speechd-0.10.2/src/server/speaking.c 2020-11-24 23:38:03.000000000 +0000
+++ ./src/server/speaking.c 2021-04-05 18:06:21.834517140 +0000
@@ -950,9 +950,10 @@
MSG(1,
"Can't fill signal set, expect problems when terminating!");
}
-
+#ifndef __ANDROID__
pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL);
+#endif __ANDROID__
}
void stop_priority_except_first(SPDPriority priority)
diff -u -r ../speechd-0.10.2/src/server/speechd.c ./src/server/speechd.c
--- ../speechd-0.10.2/src/server/speechd.c 2020-11-24 23:38:03.000000000 +0000
+++ ./src/server/speechd.c 2021-04-05 18:06:21.834517140 +0000
@@ -1285,7 +1285,7 @@
g_hash_table_destroy(fd_settings);
MSG(4, "Closing speak() thread...");
- ret = pthread_cancel(speak_thread);
+ ret = pthread_kill(speak_thread, 0);
if (ret != 0)
FATAL("Speak thread failed to cancel!\n");
--- ../speechd-0.10.2/src/modules/Makefile.am 2020-11-24 23:38:03.000000000 +0000
+++ ./src/modules/Makefile.am 2021-04-05 18:13:05.761394281 +0000
@@ -134,7 +134,7 @@
modulebin_PROGRAMS += sd_baratinoo
sd_baratinoo_SOURCES = baratinoo.c baratinoo_compat.h $(audio_SOURCES) $(common_SOURCES) module_utils_speak_queue.c
sd_baratinoo_LDADD = $(top_builddir)/src/common/libcommon.la \
- $(audio_dlopen_modules) -lbaratinoo -lpthread -ldl \
+ $(audio_dlopen_modules) -lbaratinoo -ldl \
$(common_LDADD)
if baratinoo_shim