[FFmpeg-cvslog] compat/w32pthreads: use the CONDITION_VARIABLE typedef if available
James Almer
git at videolan.org
Thu Oct 9 18:26:30 CEST 2014
ffmpeg | branch: master | James Almer <jamrial at gmail.com> | Thu Oct 9 13:20:00 2014 -0300| [0c0694931442ef9ea91eace120e0629e0ac01b76] | committer: James Almer
compat/w32pthreads: use the CONDITION_VARIABLE typedef if available
This silences warnings about passing arguments from incompatible pointer type
when targeting Windows Vista or newer.
Tested-by: Matt Oliver <protogonoi at gmail.com>
Reviewed-by: Michael Niedermayer <michaelni at gmx.at>
Signed-off-by: James Almer <jamrial at gmail.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0c0694931442ef9ea91eace120e0629e0ac01b76
---
compat/w32pthreads.h | 23 +++++++++++++----------
configure | 2 ++
2 files changed, 15 insertions(+), 10 deletions(-)
diff --git a/compat/w32pthreads.h b/compat/w32pthreads.h
index 2a7f323..8b80714 100644
--- a/compat/w32pthreads.h
+++ b/compat/w32pthreads.h
@@ -55,12 +55,15 @@ typedef struct pthread_t {
* not mutexes */
typedef CRITICAL_SECTION pthread_mutex_t;
-/* This is the CONDITIONAL_VARIABLE typedef for using Window's native
- * conditional variables on kernels 6.0+.
- * MinGW does not currently have this typedef. */
+/* This is the CONDITION_VARIABLE typedef for using Windows' native
+ * conditional variables on kernels 6.0+. */
+#if HAVE_CONDITION_VARIABLE_PTR
+typedef CONDITION_VARIABLE pthread_cond_t;
+#else
typedef struct pthread_cond_t {
- void *ptr;
+ void *Ptr;
} pthread_cond_t;
+#endif
/* function pointers to conditional variable API on windows 6.0+ kernels */
#if _WIN32_WINNT < 0x0600
@@ -159,7 +162,7 @@ static av_unused int pthread_cond_init(pthread_cond_t *cond, const void *unused_
win32_cond = av_mallocz(sizeof(win32_cond_t));
if (!win32_cond)
return ENOMEM;
- cond->ptr = win32_cond;
+ cond->Ptr = win32_cond;
win32_cond->semaphore = CreateSemaphore(NULL, 0, 0x7fffffff, NULL);
if (!win32_cond->semaphore)
return ENOMEM;
@@ -174,7 +177,7 @@ static av_unused int pthread_cond_init(pthread_cond_t *cond, const void *unused_
static av_unused void pthread_cond_destroy(pthread_cond_t *cond)
{
- win32_cond_t *win32_cond = cond->ptr;
+ win32_cond_t *win32_cond = cond->Ptr;
/* native condition variables do not destroy */
if (cond_init)
return;
@@ -185,12 +188,12 @@ static av_unused void pthread_cond_destroy(pthread_cond_t *cond)
pthread_mutex_destroy(&win32_cond->mtx_waiter_count);
pthread_mutex_destroy(&win32_cond->mtx_broadcast);
av_freep(&win32_cond);
- cond->ptr = NULL;
+ cond->Ptr = NULL;
}
static av_unused void pthread_cond_broadcast(pthread_cond_t *cond)
{
- win32_cond_t *win32_cond = cond->ptr;
+ win32_cond_t *win32_cond = cond->Ptr;
int have_waiter;
if (cond_broadcast) {
@@ -221,7 +224,7 @@ static av_unused void pthread_cond_broadcast(pthread_cond_t *cond)
static av_unused int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex)
{
- win32_cond_t *win32_cond = cond->ptr;
+ win32_cond_t *win32_cond = cond->Ptr;
int last_waiter;
if (cond_wait) {
cond_wait(cond, mutex, INFINITE);
@@ -253,7 +256,7 @@ static av_unused int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mu
static av_unused void pthread_cond_signal(pthread_cond_t *cond)
{
- win32_cond_t *win32_cond = cond->ptr;
+ win32_cond_t *win32_cond = cond->Ptr;
int have_waiter;
if (cond_signal) {
cond_signal(cond);
diff --git a/configure b/configure
index 06a2d4e..cda463d 100755
--- a/configure
+++ b/configure
@@ -1767,6 +1767,7 @@ TOOLCHAIN_FEATURES="
"
TYPES_LIST="
+ CONDITION_VARIABLE_Ptr
socklen_t
struct_addrinfo
struct_group_source_req
@@ -4719,6 +4720,7 @@ check_func_headers windows.h PeekNamedPipe
check_func_headers windows.h SetConsoleTextAttribute
check_func_headers windows.h Sleep
check_func_headers windows.h VirtualAlloc
+check_struct windows.h "CONDITION_VARIABLE" Ptr
check_func_headers glob.h glob
enabled xlib &&
check_func_headers "X11/Xlib.h X11/extensions/Xvlib.h" XvGetPortAttribute -lXv -lX11 -lXext
More information about the ffmpeg-cvslog
mailing list