On Sun, 15 Jul 2012, Måns Rullgård wrote:
Martin Storsjö <[email protected]> writes:
This was unnoticed on linux, since stdlib.h apparently includes
files declaring the pthread_mutex_t and pthread_cond_t types.
That seems unlikely.
On Ubuntu 12.04 (glibc 2.15) at least, a file containing only
#include <stdlib.h>
struct foo { pthread_mutex_t foo; };
compiles just fine.
---
libavcodec/vp8.c | 6 ------
libavcodec/vp8.h | 5 +++++
2 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/libavcodec/vp8.c b/libavcodec/vp8.c
index ee954fc..e39fc0b 100644
--- a/libavcodec/vp8.c
+++ b/libavcodec/vp8.c
@@ -31,12 +31,6 @@
#include "rectangle.h"
#include "thread.h"
-#if HAVE_PTHREADS
-#include <pthread.h>
-#elif HAVE_W32THREADS
-#include "w32pthreads.h"
-#endif
-
#if ARCH_ARM
# include "arm/vp8.h"
#endif
diff --git a/libavcodec/vp8.h b/libavcodec/vp8.h
index 1355da4..458a11a 100644
--- a/libavcodec/vp8.h
+++ b/libavcodec/vp8.h
@@ -30,6 +30,11 @@
#include "vp56data.h"
#include "vp8dsp.h"
#include "h264pred.h"
+#if HAVE_PTHREADS
+#include <pthread.h>
+#elif HAVE_W32THREADS
+#include "w32pthreads.h"
+#endif
This ifdeffery is in the wrong place. It should be abstracted somewhere
else.
Yes, and w32pthreads.h could use being converted into a proper .c file. It
has function pointers to vista-only functions for cond vars and an init
function, that are loaded only from ff_thread_init in pthread.c. The
function pointers are static, so each file that currently includes
w32pthreads.h get a separate instance of the pointers variables, and only
the one included in pthread.c actually initializes the pointers - all
others will use the pre-vista fallback.
// Martin
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel