0
0
mirror of https://github.com/termux/termux-packages.git synced 2024-11-24 01:26:15 +00:00
termux-packages/disabled-packages/transcode/src-transcode.c.patch
Tee KOBAYASHI 67af201270 transcode: Disabled
not building with Clang 16. Dead upstream.
2023-04-13 06:19:59 +09:00

54 lines
1.5 KiB
Diff

--- a/src/transcode.c
+++ b/src/transcode.c
@@ -41,6 +41,7 @@
#include <ctype.h>
#include <math.h>
+#include <stdatomic.h>
#include "cmdline.h"
@@ -215,6 +216,7 @@
/*************************************************************************/
static pthread_t event_thread_id = (pthread_t)0;
+static atomic_flag event_thread_cancel;
static const char *signame = "unknown signal";
static void tc_stop_all(void)
@@ -271,7 +273,7 @@
/* Loop waiting for external events */
for (;;) {
- pthread_testcancel();
+ if (!atomic_flag_test_and_set(&event_thread_cancel)) pthread_exit(NULL);
tc_socket_wait();
@@ -283,7 +285,7 @@
if (tc_probe_pid > 0)
kill(tc_probe_pid, SIGTERM);
}
- pthread_testcancel();
+ if (!atomic_flag_test_and_set(&event_thread_cancel)) pthread_exit(NULL);
}
return NULL;
}
@@ -305,7 +307,7 @@
void *thread_status = NULL;
// pthread_kill(event_thread_id, SIGINT);
- pthread_cancel(event_thread_id);
+ atomic_flag_clear(&event_thread_cancel);
pthread_join(event_thread_id, &thread_status);
}
}
@@ -2721,6 +2723,7 @@
tc_error("failed to initialize socket handler");
// now we start the signal handler thread
+ atomic_flag_test_and_set(&event_thread_cancel);
if (pthread_create(&event_thread_id, NULL, event_thread, &sigs_to_block) != 0)
tc_error("failed to start signal handler thread");