diff -r 9266b55758bb -r 7ec78a34de32 boost/config/posix_features.hpp --- a/boost/config/posix_features.hpp Wed Feb 11 16:10:10 2015 +0100 +++ b/boost/config/posix_features.hpp Mon Feb 16 16:36:40 2015 +0100 @@ -77,7 +77,7 @@ // Likewise for the functions log1p and expm1. # if defined(_XOPEN_VERSION) && (_XOPEN_VERSION+0 >= 500) # define BOOST_HAS_GETTIMEOFDAY -# if defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE+0 >= 500) +# if (defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE+0 >= 500)) || defined(__ANDROID__) # define BOOST_HAS_PTHREAD_MUTEXATTR_SETTYPE # endif # ifndef BOOST_HAS_LOG1P diff -r 9266b55758bb -r 7ec78a34de32 boost/thread/pthread/mutex.hpp --- a/boost/thread/pthread/mutex.hpp Wed Feb 11 16:10:10 2015 +0100 +++ b/boost/thread/pthread/mutex.hpp Mon Feb 16 16:36:40 2015 +0100 @@ -26,8 +26,7 @@ #endif #include -#ifdef _POSIX_TIMEOUTS -#if _POSIX_TIMEOUTS >= 0 && _POSIX_TIMEOUTS>=200112L +#if (defined(_POSIX_TIMEOUTS) && _POSIX_TIMEOUTS >= 0 && _POSIX_TIMEOUTS>=200112L) || defined(__ANDROID__) #ifndef BOOST_PTHREAD_HAS_TIMEDLOCK #define BOOST_PTHREAD_HAS_TIMEDLOCK #endif #endif -#endif #include @@ -244,7 +243,11 @@ private: bool do_try_lock_until(struct timespec const &timeout) { +#if defined(__ANDROID__) && (__ANDROID_API__ < 21) + int const res=pthread_mutex_timedlock(&m,(struct timespec*)&timeout); +#else int const res=pthread_mutex_timedlock(&m,&timeout); +#endif BOOST_ASSERT(!res || res==ETIMEDOUT); return !res; } diff -r 9266b55758bb -r 7ec78a34de32 boost/thread/pthread/recursive_mutex.hpp --- a/boost/thread/pthread/recursive_mutex.hpp Wed Feb 11 16:10:10 2015 +0100 +++ b/boost/thread/pthread/recursive_mutex.hpp Mon Feb 16 16:36:40 2015 +0100 @@ -27,15 +27,16 @@ #endif #include -#ifdef _POSIX_TIMEOUTS -#if _POSIX_TIMEOUTS >= 0 && _POSIX_TIMEOUTS>=200112L +#if (defined(_POSIX_TIMEOUTS) && _POSIX_TIMEOUTS >= 0 && _POSIX_TIMEOUTS>=200112L) || defined(__ANDROID__) #ifndef BOOST_PTHREAD_HAS_TIMEDLOCK #define BOOST_PTHREAD_HAS_TIMEDLOCK #endif #endif @@ -267,7 +286,11 @@ private: bool do_try_lock_until(struct timespec const &timeout) { +#if defined(__ANDROID__) && (__ANDROID_API__ < 21) + int const res=pthread_mutex_timedlock(&m,(struct timespec*)&timeout); +#else int const res=pthread_mutex_timedlock(&m,&timeout); +#endif BOOST_ASSERT(!res || res==ETIMEDOUT); return !res; }