PR #25143 opened by Zhao Zhili (quink)
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/25143
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/25143.patch

# Summary of changes

HAVE_PTHREAD_CANCEL has no consumers left: udp no longer cancels its
receive thread, and the dnn guards were already removed.

Android bionic and Windows w32threads do not provide pthread_cancel(),
and on Darwin a cancel request made while cancellation is disabled may
never acted on (see PR #24886). Probing for pthread_cancel may invite
new code to depend on it.

<!--
If this PR requires new FATE test samples, attach them to the PR and
list their target paths below (relative to the fate-suite root).

Attached filenames must match the sample's filename:

```fate-samples
# e.g. vorbis/new-sample.ogg
```
-->



>From 10c770c25f1ba24034105764e05867dd309571a3 Mon Sep 17 00:00:00 2001
From: Zhao Zhili <[email protected]>
Date: Sat, 17 Oct 2026 14:14:00 +0800
Subject: [PATCH 1/2] configure: stop probing for pthread_cancel

HAVE_PTHREAD_CANCEL has no consumers left: udp no longer cancels its
receive thread, and the dnn guards were already removed.

Android bionic and Windows w32threads do not provide pthread_cancel(),
and on Darwin a cancel request made while cancellation is disabled may
never acted on (see PR #24886). Probing for pthread_cancel may invite
new code to depend on it.

Signed-off-by: Zhao Zhili <[email protected]>
---
 configure | 2 --
 1 file changed, 2 deletions(-)

diff --git a/configure b/configure
index c97ddb186f..91f4f9661b 100755
--- a/configure
+++ b/configure
@@ -2540,7 +2540,6 @@ SYSTEM_FUNCS="
     PeekNamedPipe
     posix_memalign
     prctl
-    pthread_cancel
     pthread_set_name_np
     pthread_setaffinity_np
     pthread_setname_np
@@ -7152,7 +7151,6 @@ if ! disabled pthreads && ! enabled w32threads && ! 
enabled os2threads; then
 
     if enabled pthreads; then
         check_builtin sem_timedwait semaphore.h "sem_t *s; sem_init(s,0,0); 
sem_timedwait(s,0); sem_destroy(s)" $pthreads_extralibs
-        check_func pthread_cancel $pthreads_extralibs
         hdrs=pthread.h
         if enabled pthread_np_h; then
             hdrs="$hdrs pthread_np.h"
-- 
2.54.0


>From fde547a0404ee42ad124d95914e8d7497ed2983f Mon Sep 17 00:00:00 2001
From: Zhao Zhili <[email protected]>
Date: Sat, 17 Oct 2026 14:14:00 +0800
Subject: [PATCH 2/2] compat/w32pthreads: drop the cancellation stubs

0830e9116f added pthread_setcancelstate() and the PTHREAD_CANCEL_*
values for the udp receive thread, which is no longer cancelled and
does not call them. No other file refers to them.

Signed-off-by: Zhao Zhili <[email protected]>
---
 compat/w32pthreads.h | 8 --------
 1 file changed, 8 deletions(-)

diff --git a/compat/w32pthreads.h b/compat/w32pthreads.h
index d39d3dc428..548c6085e9 100644
--- a/compat/w32pthreads.h
+++ b/compat/w32pthreads.h
@@ -63,9 +63,6 @@ typedef CONDITION_VARIABLE pthread_cond_t;
 #define InitializeCriticalSection(x) InitializeCriticalSectionEx(x, 0, 0)
 #define WaitForSingleObject(a, b) WaitForSingleObjectEx(a, b, FALSE)
 
-#define PTHREAD_CANCEL_ENABLE 1
-#define PTHREAD_CANCEL_DISABLE 0
-
 #if HAVE_WINRT
 #define THREADFUNC_RETTYPE DWORD
 #else
@@ -210,11 +207,6 @@ static inline int pthread_cond_signal(pthread_cond_t *cond)
     return 0;
 }
 
-static inline int pthread_setcancelstate(int state, int *oldstate)
-{
-    return 0;
-}
-
 static inline int win32_thread_setname(const char *name)
 {
 #if !HAVE_UWP
-- 
2.54.0

_______________________________________________
ffmpeg-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to