--- a/src/server/speechd.c	2022-04-15 04:49:54.443394249 +0000
+++ b/src/server/speechd.c	2022-04-15 06:14:44.973486291 +0000
@@ -1353,7 +1353,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");
 
--- a/src/modules/module_utils.c	2022-04-15 04:49:54.468395993 +0000
+++ b/src/modules/module_utils.c	2022-04-15 06:07:29.462108958 +0000
@@ -584,7 +584,7 @@
 {
 	int ret;
 
-	ret = pthread_cancel(thread);
+	ret = pthread_kill(thread, 0);
 	if (ret != 0) {
 		DBG("Cancellation of speak thread failed");
 		return 1;
--- a/src/audio/nas.c	2022-04-15 04:49:54.442394179 +0000
+++ b/src/audio/nas.c	2022-04-15 05:57:51.188773780 +0000
@@ -51,8 +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);
 
@@ -208,7 +206,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);
--- a/src/api/c/libspeechd.c	2022-04-15 04:49:54.445394389 +0000
+++ b/src/api/c/libspeechd.c	2022-04-15 05:47:47.292651531 +0000
@@ -607,7 +607,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);
--- a/src/common/common.c	2022-04-15 04:49:54.442394179 +0000
+++ b/src/common/common.c	2022-04-15 14:25:51.987242432 +0000
@@ -49,6 +49,4 @@
 
 void set_speaking_thread_parameters(void)
 {
-	pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
-	pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL);
 }
--- a/src/server/output.c	2022-04-15 04:49:54.443394249 +0000
+++ b/src/server/output.c	2022-04-15 14:30:36.748824687 +0000
@@ -218,8 +218,6 @@
 void
 static output_lock(void)
 {
-	if (pthread_self() == speak_thread)
-		pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &oldstate);
 	pthread_mutex_lock(&output_layer_mutex);
 }
 
@@ -227,8 +225,6 @@
 static output_unlock(void)
 {
 	pthread_mutex_unlock(&output_layer_mutex);
-	if (pthread_self() == speak_thread)
-		pthread_setcancelstate(oldstate, NULL);
 }
 
 #define OL_RET(value) \
