| 142 | |
| 143 | template <typename MutexType1, typename MutexType2> |
| 144 | void lock_impl(MutexType1& m1, MutexType2& m2, is_mutex_type_wrapper<true> ) |
| 145 | { |
| 146 | unsigned const lock_count = 2; |
| 147 | unsigned lock_first = 0; |
| 148 | for (;;) |
| 149 | { |
| 150 | switch (lock_first) |
| 151 | { |
| 152 | case 0: |
| 153 | lock_first = detail::lock_helper(m1, m2); |
| 154 | if (!lock_first) return; |
| 155 | break; |
| 156 | case 1: |
| 157 | lock_first = detail::lock_helper(m2, m1); |
| 158 | if (!lock_first) return; |
| 159 | lock_first = (lock_first + 1) % lock_count; |
| 160 | break; |
| 161 | } |
| 162 | } |
| 163 | } |
| 164 | |
| 165 | template <typename Iterator> |
| 166 | void lock_impl(Iterator begin, Iterator end, is_mutex_type_wrapper<false> ); |