summaryrefslogtreecommitdiff
path: root/src/AntFr310XT.cpp
diff options
context:
space:
mode:
authorRALOVICH, Kristof <tade60@freemail.hu>2013-12-07 17:08:55 +0100
committerRALOVICH, Kristof <tade60@freemail.hu>2013-12-07 17:08:55 +0100
commita4d748831af900756e81150a7dea15dd77725692 (patch)
tree93412eb83825b75d13826cfb0ce27dfee704ca98 /src/AntFr310XT.cpp
parent93e79a999250d2c5de834e5b2ecde1b04d58bec9 (diff)
checkForExit() after downloading each file
the "correct" (even more responsive for user) solution would be to push this check further down into the download logic
Diffstat (limited to 'src/AntFr310XT.cpp')
-rw-r--r--src/AntFr310XT.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/AntFr310XT.cpp b/src/AntFr310XT.cpp
index d3cfed8..3689367 100644
--- a/src/AntFr310XT.cpp
+++ b/src/AntFr310XT.cpp
@@ -263,6 +263,17 @@ AntFr310XT2::handleEvents()
} \
} while(0)
+#define checkForExit() do \
+ { \
+ boost::unique_lock<boost::mutex> lock(this->stateMtx); \
+ if(this->state == ST_ANTFS_LAST) \
+ { \
+ lock.unlock(); \
+ this->stop(); \
+ return true; \
+ } \
+ } while(0)
+
while(!m_evQue.empty())
{
AntMessage m;
@@ -473,6 +484,7 @@ AntFr310XT2::handleEvents()
uint fileCnt=0;
for(size_t i=0; i<zfc.waypointsFiles.size() && fileCnt<m_ds->MaxFileDownloads; i++)
{
+ checkForExit();
LOG_VAR3(fileCnt, m_ds->MaxFileDownloads, zfc.waypointsFiles.size());
ushort fileIdx = zfc.waypointsFiles[i];
time_t t = GarminConvert::gOffsetTime(zfc.getFitFileTime(fileIdx));
@@ -507,6 +519,7 @@ AntFr310XT2::handleEvents()
for (size_t i=0; i<zfc.activityFiles.size() && fileCnt<m_ds->MaxFileDownloads; i++)
{
+ checkForExit();
LOG_VAR3(fileCnt, m_ds->MaxFileDownloads, zfc.activityFiles.size());
ushort fileIdx = zfc.activityFiles[i];
time_t t = GarminConvert::gOffsetTime(zfc.getFitFileTime(fileIdx));
@@ -548,6 +561,7 @@ AntFr310XT2::handleEvents()
for (size_t i=0; i<zfc.courseFiles.size() && fileCnt<m_ds->MaxFileDownloads; i++)
{
+ checkForExit();
LOG_VAR3(fileCnt, m_ds->MaxFileDownloads, zfc.courseFiles.size());
ushort fileIdx = zfc.courseFiles[i];
time_t t = GarminConvert::gOffsetTime(zfc.getFitFileTime(fileIdx));