[vlc-devel] [PATCH] Android: Add pthread conditional attribute workaround

Rafaël Carré rafael.carre at gmail.com
Tue Jan 3 23:09:23 CET 2012


Le 2012-01-03 17:01, Edward Wang a écrit :
> 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
>  }
>  
>  /**

You shouldn't disable those on Android 2.2+



More information about the vlc-devel mailing list