| 1180 | } |
| 1181 | |
| 1182 | template<class T> bool atomic_compare_exchange( shared_ptr<T> * p, shared_ptr<T> * v, shared_ptr<T> w ) BOOST_SP_NOEXCEPT |
| 1183 | { |
| 1184 | boost::detail::spinlock & sp = boost::detail::spinlock_pool<2>::spinlock_for( p ); |
| 1185 | |
| 1186 | sp.lock(); |
| 1187 | |
| 1188 | if( p->_internal_equiv( *v ) ) |
| 1189 | { |
| 1190 | p->swap( w ); |
| 1191 | |
| 1192 | sp.unlock(); |
| 1193 | |
| 1194 | return true; |
| 1195 | } |
| 1196 | else |
| 1197 | { |
| 1198 | shared_ptr<T> tmp( *p ); |
| 1199 | |
| 1200 | sp.unlock(); |
| 1201 | |
| 1202 | tmp.swap( *v ); |
| 1203 | return false; |
| 1204 | } |
| 1205 | } |
| 1206 | |
| 1207 | template<class T, class M> inline bool atomic_compare_exchange_explicit( shared_ptr<T> * p, shared_ptr<T> * v, shared_ptr<T> w, /*memory_order success*/ M, /*memory_order failure*/ M ) BOOST_SP_NOEXCEPT |
| 1208 | { |