/// Empty backoff strategy. Do nothing
struct empty {
//@cond
- void operator ()()
+ void operator ()() const CDS_NOEXCEPT
{}
template <typename Predicate>
- bool operator()( Predicate pr )
+ bool operator()(Predicate pr) CDS_NOEXCEPT_( noexcept(Predicate()()) )
{
return pr();
}
- void reset()
+ void reset() const CDS_NOEXCEPT
{}
//@endcond
};
/// Switch to another thread (yield). Good for thread preemption architecture.
struct yield {
//@cond
- void operator ()()
+ void operator ()() CDS_NOEXCEPT
{
std::this_thread::yield();
}
template <typename Predicate>
- bool operator()( Predicate pr )
+ bool operator()( Predicate pr ) CDS_NOEXCEPT_( noexcept( Predicate()() ) )
{
if ( pr() )
return true;
return false;
}
- void reset()
+ void reset() const CDS_NOEXCEPT
{}
//@endcond
};
*/
struct pause {
//@cond
- void operator ()()
+ void operator ()() CDS_NOEXCEPT
{
# ifdef CDS_backoff_pause_defined
platform::backoff_pause();
}
template <typename Predicate>
- bool operator()( Predicate pr )
+ bool operator()( Predicate pr ) CDS_NOEXCEPT_( noexcept( Predicate()() ) )
{
if ( pr() )
return true;
return false;
}
- void reset()
+ void reset() const CDS_NOEXCEPT
{}
//@endcond
};
struct hint
{
//@cond
- void operator ()()
+ void operator ()() CDS_NOEXCEPT
{
# if defined(CDS_backoff_hint_defined)
platform::backoff_hint();
}
template <typename Predicate>
- bool operator()( Predicate pr )
+ bool operator()( Predicate pr ) CDS_NOEXCEPT_( noexcept( Predicate()() ) )
{
if ( pr() )
return true;
return false;
}
- void reset()
+ void reset() const CDS_NOEXCEPT
{}
//@endcond
};
public:
/// Initializes m_nExpMin and m_nExpMax from default s_nExpMin and s_nExpMax respectively
- exponential()
+ exponential() CDS_NOEXCEPT
: m_nExpMin( s_nExpMin )
, m_nExpMax( s_nExpMax )
{
exponential(
size_t nExpMin, ///< Minimum spinning
size_t nExpMax ///< Maximum spinning
- )
+ ) CDS_NOEXCEPT
: m_nExpMin( nExpMin )
, m_nExpMax( nExpMax )
{
}
//@cond
- void operator ()()
+ void operator ()() CDS_NOEXCEPT_(noexcept(spin_backoff()()) && noexcept(yield_backoff()()))
{
if ( m_nExpCur <= m_nExpMax ) {
for ( size_t n = 0; n < m_nExpCur; ++n )
}
template <typename Predicate>
- bool operator()( Predicate pr )
+ bool operator()( Predicate pr ) CDS_NOEXCEPT_( noexcept(Predicate()()) && noexcept( spin_backoff()()) && noexcept( yield_backoff()()))
{
if ( m_nExpCur <= m_nExpMax ) {
for ( size_t n = 0; n < m_nExpCur; ++n ) {
return false;
}
- void reset()
+ void reset() CDS_NOEXCEPT_(noexcept(spin_backoff().reset()) && noexcept(yield_backoff().reset()))
{
m_nExpCur = m_nExpMin;
m_bkSpin.reset();
public:
/// Default ctor takes the timeout from s_nTimeout
- delay()
+ delay() CDS_NOEXCEPT
: m_nTimeout( s_nTimeout )
{}
/// Initializes timeout from \p nTimeout
- CDS_CONSTEXPR delay( unsigned int nTimeout )
+ CDS_CONSTEXPR delay( unsigned int nTimeout ) CDS_NOEXCEPT
: m_nTimeout( nTimeout )
{}
//@cond
- void operator()() const
+ void operator()() const CDS_NOEXCEPT
{
std::this_thread::sleep_for( duration_type( m_nTimeout ));
}
template <typename Predicate>
- bool operator()( Predicate pr ) const
+ bool operator()( Predicate pr ) const CDS_NOEXCEPT_( noexcept(Predicate()()))
{
for ( unsigned int i = 0; i < m_nTimeout; i += 2 ) {
if ( pr() )
return false;
}
- void reset() const
+ void reset() const CDS_NOEXCEPT
{}
//@endcond
};
//@cond
typedef delay<Duration> base_class;
public:
- delay_of()
+ delay_of() CDS_NOEXCEPT
: base_class( Timeout )
{}
//@endcond