summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRALOVICH, Kristof <tade60@freemail.hu>2014-01-19 15:37:26 +0100
committerRALOVICH, Kristof <tade60@freemail.hu>2014-01-19 15:37:26 +0100
commit3e87d216b7492a378379091d888e7a0e0db26fce (patch)
tree63e2055b29ba43b2328d7aaee94f488db925f9b9
parentc0109c44b5f6f88efd5f1f5d9b84890d6306083e (diff)
AntChannel: bugfix
Previously we missed a case of spurious wakeup possibility.
-rw-r--r--src/AntChannel.cpp18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/AntChannel.cpp b/src/AntChannel.cpp
index 2594501..31c90a5 100644
--- a/src/AntChannel.cpp
+++ b/src/AntChannel.cpp
@@ -111,8 +111,8 @@ AntListenerBase::waitForMsg(AntMessage* m, const size_t timeout_ms)
// false means, timeout was reached
return false;
}
- // true means, either nitification OR spurious wakeup!!
- //assert(m_msgResp); // this maught fail for spurious wakeups!!
+ // true means, either notification OR spurious wakeup!!
+ //assert(m_msgResp); // this might fail for spurious wakeups!!
if(m_msgResp)
{
if(m) *m=*m_msgResp;//copy
@@ -256,10 +256,18 @@ AntBurstListener::waitForBursts(std::list<AntMessage>& bs, const size_t timeout_
}
// TODO: handle arrival of event:EVENT_RX_FAIL
if(!m_cndResp.timed_wait(lock, boost::posix_time::milliseconds(timeout_ms)))
+ {
+ // // false means, timeout was reached
return false;
- assert(!bursts.empty());
- std::swap(bs, bursts);
- return true;
+ }
+ // true means, either notification OR spurious wakeup!!
+ //assert(!bursts.empty()); // this might fail for spurious wakeups!!
+ if(!bursts.empty())
+ {
+ std::swap(bs, bursts);
+ return true;
+ }
+ return false;
}