MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / atomic_compare_exchange

Function atomic_compare_exchange

extern/boost/boost/smart_ptr/shared_ptr.hpp:1182–1205  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1180}
1181
1182template<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
1207template<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{

Callers 4

lazy_initFunction · 0.85
lazy_initMethod · 0.85
lazy_initMethod · 0.85

Calls 3

lockMethod · 0.45
swapMethod · 0.45
unlockMethod · 0.45

Tested by

no test coverage detected