Mercurial > hg > vamp-build-and-test
comparison DEPENDENCIES/generic/include/boost/thread/pthread/recursive_mutex.hpp @ 101:c530137014c0
Update Boost headers (1.58.0)
| author | Chris Cannam |
|---|---|
| date | Mon, 07 Sep 2015 11:12:49 +0100 |
| parents | 2665513ce2d3 |
| children |
comparison
equal
deleted
inserted
replaced
| 100:793467b5e61c | 101:c530137014c0 |
|---|---|
| 25 #include <boost/chrono/system_clocks.hpp> | 25 #include <boost/chrono/system_clocks.hpp> |
| 26 #include <boost/chrono/ceil.hpp> | 26 #include <boost/chrono/ceil.hpp> |
| 27 #endif | 27 #endif |
| 28 #include <boost/thread/detail/delete.hpp> | 28 #include <boost/thread/detail/delete.hpp> |
| 29 | 29 |
| 30 #ifdef _POSIX_TIMEOUTS | 30 #if (defined _POSIX_TIMEOUTS && (_POSIX_TIMEOUTS-0)>=200112L) \ |
| 31 #if _POSIX_TIMEOUTS >= 0 && _POSIX_TIMEOUTS>=200112L | 31 || (defined __ANDROID__ && defined __ANDROID_API__ && __ANDROID_API__ >= 21) |
| 32 #ifndef BOOST_PTHREAD_HAS_TIMEDLOCK | 32 #ifndef BOOST_PTHREAD_HAS_TIMEDLOCK |
| 33 #define BOOST_PTHREAD_HAS_TIMEDLOCK | 33 #define BOOST_PTHREAD_HAS_TIMEDLOCK |
| 34 #endif | 34 #endif |
| 35 #endif | 35 #endif |
| 36 #endif | 36 |
| 37 | 37 #if defined BOOST_HAS_PTHREAD_MUTEXATTR_SETTYPE \ |
| 38 | 38 || defined __ANDROID__ |
| 39 #if defined(BOOST_HAS_PTHREAD_MUTEXATTR_SETTYPE) && defined(BOOST_PTHREAD_HAS_TIMEDLOCK) | 39 #define BOOST_THREAD_HAS_PTHREAD_MUTEXATTR_SETTYPE |
| 40 #endif | |
| 41 | |
| 42 #if defined BOOST_THREAD_HAS_PTHREAD_MUTEXATTR_SETTYPE && defined BOOST_PTHREAD_HAS_TIMEDLOCK | |
| 40 #define BOOST_USE_PTHREAD_RECURSIVE_TIMEDLOCK | 43 #define BOOST_USE_PTHREAD_RECURSIVE_TIMEDLOCK |
| 41 #endif | 44 #endif |
| 42 | 45 |
| 43 #include <boost/config/abi_prefix.hpp> | 46 #include <boost/config/abi_prefix.hpp> |
| 44 | 47 |
| 46 { | 49 { |
| 47 class recursive_mutex | 50 class recursive_mutex |
| 48 { | 51 { |
| 49 private: | 52 private: |
| 50 pthread_mutex_t m; | 53 pthread_mutex_t m; |
| 51 #ifndef BOOST_HAS_PTHREAD_MUTEXATTR_SETTYPE | 54 #ifndef BOOST_THREAD_HAS_PTHREAD_MUTEXATTR_SETTYPE |
| 52 pthread_cond_t cond; | 55 pthread_cond_t cond; |
| 53 bool is_locked; | 56 bool is_locked; |
| 54 pthread_t owner; | 57 pthread_t owner; |
| 55 unsigned count; | 58 unsigned count; |
| 56 #endif | 59 #endif |
| 57 public: | 60 public: |
| 58 BOOST_THREAD_NO_COPYABLE(recursive_mutex) | 61 BOOST_THREAD_NO_COPYABLE(recursive_mutex) |
| 59 recursive_mutex() | 62 recursive_mutex() |
| 60 { | 63 { |
| 61 #ifdef BOOST_HAS_PTHREAD_MUTEXATTR_SETTYPE | 64 #ifdef BOOST_THREAD_HAS_PTHREAD_MUTEXATTR_SETTYPE |
| 62 pthread_mutexattr_t attr; | 65 pthread_mutexattr_t attr; |
| 63 | 66 |
| 64 int const init_attr_res=pthread_mutexattr_init(&attr); | 67 int const init_attr_res=pthread_mutexattr_init(&attr); |
| 65 if(init_attr_res) | 68 if(init_attr_res) |
| 66 { | 69 { |
| 97 #endif | 100 #endif |
| 98 } | 101 } |
| 99 ~recursive_mutex() | 102 ~recursive_mutex() |
| 100 { | 103 { |
| 101 BOOST_VERIFY(!pthread_mutex_destroy(&m)); | 104 BOOST_VERIFY(!pthread_mutex_destroy(&m)); |
| 102 #ifndef BOOST_HAS_PTHREAD_MUTEXATTR_SETTYPE | 105 #ifndef BOOST_THREAD_HAS_PTHREAD_MUTEXATTR_SETTYPE |
| 103 BOOST_VERIFY(!pthread_cond_destroy(&cond)); | 106 BOOST_VERIFY(!pthread_cond_destroy(&cond)); |
| 104 #endif | 107 #endif |
| 105 } | 108 } |
| 106 | 109 |
| 107 #ifdef BOOST_HAS_PTHREAD_MUTEXATTR_SETTYPE | 110 #ifdef BOOST_THREAD_HAS_PTHREAD_MUTEXATTR_SETTYPE |
| 108 void lock() | 111 void lock() |
| 109 { | 112 { |
| 110 BOOST_VERIFY(!pthread_mutex_lock(&m)); | 113 BOOST_VERIFY(!pthread_mutex_lock(&m)); |
| 111 } | 114 } |
| 112 | 115 |
