[FFmpeg-cvslog] avformat/udp: support w32pthreads compat
phunkyfish
git at videolan.org
Sun Mar 8 20:34:30 EET 2020
ffmpeg | branch: master | phunkyfish <phunkyfish at gmail.com> | Mon Mar 2 20:48:41 2020 +0000| [0830e9116f786572865a9c800a9156d0c4294f27] | committer: Marton Balint
avformat/udp: support w32pthreads compat
Signed-off-by: Marton Balint <cus at passwd.hu>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0830e9116f786572865a9c800a9156d0c4294f27
---
compat/w32pthreads.h | 8 ++++++++
libavformat/udp.c | 7 ++++++-
2 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/compat/w32pthreads.h b/compat/w32pthreads.h
index 7df33b7da4..6405e72b64 100644
--- a/compat/w32pthreads.h
+++ b/compat/w32pthreads.h
@@ -63,6 +63,9 @@ 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
+
static av_unused unsigned __stdcall attribute_align_arg win32thread_worker(void *arg)
{
pthread_t *h = (pthread_t*)arg;
@@ -180,4 +183,9 @@ static inline int pthread_cond_signal(pthread_cond_t *cond)
return 0;
}
+static inline int pthread_setcancelstate(int state, int *oldstate)
+{
+ return 0;
+}
+
#endif /* COMPAT_W32PTHREADS_H */
diff --git a/libavformat/udp.c b/libavformat/udp.c
index 23c3773c64..ad6992c57d 100644
--- a/libavformat/udp.c
+++ b/libavformat/udp.c
@@ -61,8 +61,13 @@
#define IPPROTO_UDPLITE 136
#endif
+#if HAVE_W32THREADS
+#undef HAVE_PTHREAD_CANCEL
+#define HAVE_PTHREAD_CANCEL 1
+#endif
+
#if HAVE_PTHREAD_CANCEL
-#include <pthread.h>
+#include "libavutil/thread.h"
#endif
#ifndef IPV6_ADD_MEMBERSHIP
More information about the ffmpeg-cvslog
mailing list