Ticket #11035: boost_recursive_mutex.2.patch

File boost_recursive_mutex.2.patch, 2.6 KB (added by Cédric OCHS <kervala@…>, 8 years ago)

Fix of the patch

  • boost/config/posix_features.hpp

    diff -r 9266b55758bb -r 7ec78a34de32 boost/config/posix_features.hpp
    a b  
    7777      // Likewise for the functions log1p and expm1.
    7878#     if defined(_XOPEN_VERSION) && (_XOPEN_VERSION+0 >= 500)
    7979#        define BOOST_HAS_GETTIMEOFDAY
    80 #        if defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE+0 >= 500)
     80#        if (defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE+0 >= 500)) || defined(__ANDROID__)
    8181#           define BOOST_HAS_PTHREAD_MUTEXATTR_SETTYPE
    8282#        endif
    8383#        ifndef BOOST_HAS_LOG1P
  • boost/thread/pthread/mutex.hpp

    diff -r 9266b55758bb -r 7ec78a34de32 boost/thread/pthread/mutex.hpp
    a b  
    2626#endif
    2727#include <boost/thread/detail/delete.hpp>
    2828
    29 #ifdef _POSIX_TIMEOUTS
    30 #if _POSIX_TIMEOUTS >= 0 && _POSIX_TIMEOUTS>=200112L
     29#if (defined(_POSIX_TIMEOUTS) && _POSIX_TIMEOUTS >= 0 && _POSIX_TIMEOUTS>=200112L) || defined(__ANDROID__)
    3130#ifndef BOOST_PTHREAD_HAS_TIMEDLOCK
    3231#define BOOST_PTHREAD_HAS_TIMEDLOCK
    3332#endif
  • boost/thread/pthread/recursive_mutex.hpp

     #endif
    -#endif
     
     
     #include <boost/config/abi_prefix.hpp>
    @@ -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 b (this hunk was shorter than expected)  
    2727#endif
    2828#include <boost/thread/detail/delete.hpp>
    2929
    30 #ifdef _POSIX_TIMEOUTS
    31 #if _POSIX_TIMEOUTS >= 0 && _POSIX_TIMEOUTS>=200112L
     30#if (defined(_POSIX_TIMEOUTS) && _POSIX_TIMEOUTS >= 0 && _POSIX_TIMEOUTS>=200112L) || defined(__ANDROID__)
    3231#ifndef BOOST_PTHREAD_HAS_TIMEDLOCK
    3332#define BOOST_PTHREAD_HAS_TIMEDLOCK
    3433#endif
    3534#endif
     
    267286    private:
    268287        bool do_try_lock_until(struct timespec const &timeout)
    269288        {
     289#if defined(__ANDROID__) && (__ANDROID_API__ < 21)
     290            int const res=pthread_mutex_timedlock(&m,(struct timespec*)&timeout);
     291#else
    270292            int const res=pthread_mutex_timedlock(&m,&timeout);
     293#endif
    271294            BOOST_ASSERT(!res || res==ETIMEDOUT);
    272295            return !res;
    273296        }