[vlc-devel] [PATCH] Android: Add pthread conditional attribute workaround
Edward Wang
edward.c.wang at compdigitec.com
Tue Jan 3 23:01:40 CET 2012
Bypass pthread_condattr_* functions under Android because Android 2.2 and under doesn't support pthread_condattr_* functions.
Thanks,
Edward Wang
---
src/posix/thread.c | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/src/posix/thread.c b/src/posix/thread.c
index dd5b2fd..8edd56d 100644
--- a/src/posix/thread.c
+++ b/src/posix/thread.c
@@ -358,14 +358,22 @@ void vlc_cond_init (vlc_cond_t *p_condvar)
pthread_condattr_t attr;
vlc_clock_setup ();
+#ifndef __ANDROID__
if (unlikely(pthread_condattr_init (&attr)))
abort ();
+#endif
#if (_POSIX_CLOCK_SELECTION > 0)
pthread_condattr_setclock (&attr, vlc_clock_id);
#endif
+#ifdef __ANDROID__
+ if (unlikely(pthread_cond_init (p_condvar, NULL)))
+#else
if (unlikely(pthread_cond_init (p_condvar, &attr)))
+#endif
abort ();
+#ifndef __ANDROID__
pthread_condattr_destroy (&attr);
+#endif
}
/**
--
1.7.5.4
More information about the vlc-devel
mailing list