projects
/
libcds.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
25f6df9
)
back-off strategies: use std::declval in noexcept specifications
author
khizmax
<khizmax@gmail.com>
Wed, 26 Nov 2014 16:39:07 +0000
(19:39 +0300)
committer
khizmax
<khizmax@gmail.com>
Wed, 26 Nov 2014 16:39:07 +0000
(19:39 +0300)
cds/algo/backoff_strategy.h
patch
|
blob
|
history
diff --git
a/cds/algo/backoff_strategy.h
b/cds/algo/backoff_strategy.h
index c80ea829d43d365d7a55d220c4a13dabb98b1b4e..75f43e347f28c3a0666283032946f4cf108838fb 100644
(file)
--- a/
cds/algo/backoff_strategy.h
+++ b/
cds/algo/backoff_strategy.h
@@
-16,6
+16,7
@@
2009.09.10 Maxim Khiszinsky reset() function added
*/
2009.09.10 Maxim Khiszinsky reset() function added
*/
+#include <utility> // declval
#include <thread>
#include <chrono>
#include <cds/compiler/backoff.h>
#include <thread>
#include <chrono>
#include <cds/compiler/backoff.h>
@@
-59,7
+60,7
@@
namespace cds {
{}
template <typename Predicate>
{}
template <typename Predicate>
- bool operator()(Predicate pr) CDS_NOEXCEPT
+ bool operator()(Predicate pr) CDS_NOEXCEPT
_( noexcept(std::declval<Predicate>()() ))
{
return pr();
}
{
return pr();
}
@@
-78,7
+79,7
@@
namespace cds {
}
template <typename Predicate>
}
template <typename Predicate>
- bool operator()(
Predicate pr ) CDS_NOEXCEPT
+ bool operator()(
Predicate pr) CDS_NOEXCEPT_( noexcept(std::declval<Predicate>()() ))
{
if ( pr() )
return true;
{
if ( pr() )
return true;
@@
-106,7
+107,7
@@
namespace cds {
}
template <typename Predicate>
}
template <typename Predicate>
- bool operator()(
Predicate pr ) CDS_NOEXCEPT
+ bool operator()(
Predicate pr) CDS_NOEXCEPT_( noexcept(std::declval<Predicate>()() ))
{
if ( pr() )
return true;
{
if ( pr() )
return true;
@@
-137,7
+138,7
@@
namespace cds {
}
template <typename Predicate>
}
template <typename Predicate>
- bool operator()(
Predicate pr ) CDS_NOEXCEPT
+ bool operator()(
Predicate pr) CDS_NOEXCEPT_(noexcept(std::declval<Predicate>()() ))
{
if ( pr() )
return true;
{
if ( pr() )
return true;
@@
-252,7
+253,7
@@
namespace cds {
}
//@cond
}
//@cond
- void operator ()() CDS_NOEXCEPT_(noexcept(s
pin_backoff()()) && noexcept(yield_backoff
()()))
+ void operator ()() CDS_NOEXCEPT_(noexcept(s
td::declval<spin_backoff>()()) && noexcept(std::declval<yield_backoff>
()()))
{
if ( m_nExpCur <= m_nExpMax ) {
for ( size_t n = 0; n < m_nExpCur; ++n )
{
if ( m_nExpCur <= m_nExpMax ) {
for ( size_t n = 0; n < m_nExpCur; ++n )
@@
-264,7
+265,7
@@
namespace cds {
}
template <typename Predicate>
}
template <typename Predicate>
- bool operator()( Predicate pr ) CDS_NOEXCEPT_(
noexcept( spin_backoff()()) && noexcept( yield_backoff()()
))
+ bool operator()( Predicate pr ) CDS_NOEXCEPT_(
noexcept(std::declval<Predicate>()()) && noexcept(std::declval<spin_backoff>()()) && noexcept(std::declval<yield_backoff>()()
))
{
if ( m_nExpCur <= m_nExpMax ) {
for ( size_t n = 0; n < m_nExpCur; ++n ) {
{
if ( m_nExpCur <= m_nExpMax ) {
for ( size_t n = 0; n < m_nExpCur; ++n ) {
@@
-278,7
+279,7
@@
namespace cds {
return false;
}
return false;
}
- void reset() CDS_NOEXCEPT_(
noexcept(spin_backoff().reset()) && noexcept(yield_backoff().reset()
))
+ void reset() CDS_NOEXCEPT_(
noexcept( std::declval<spin_backoff>().reset() ) && noexcept( std::declval<yield_backoff>().reset()
))
{
m_nExpCur = m_nExpMin;
m_bkSpin.reset();
{
m_nExpCur = m_nExpMin;
m_bkSpin.reset();
@@
-365,13
+366,13
@@
namespace cds {
{}
//@cond
{}
//@cond
- void operator()() const
CDS_NOEXCEPT
+ void operator()() const
{
std::this_thread::sleep_for( duration_type( m_nTimeout ));
}
template <typename Predicate>
{
std::this_thread::sleep_for( duration_type( m_nTimeout ));
}
template <typename Predicate>
- bool operator()(
Predicate pr ) const CDS_NOEXCEPT
+ bool operator()(
Predicate pr) const
{
for ( unsigned int i = 0; i < m_nTimeout; i += 2 ) {
if ( pr() )
{
for ( unsigned int i = 0; i < m_nTimeout; i += 2 ) {
if ( pr() )