diff options
author | Lev Dragunov <l.dragunov@corp.mail.ru> | 2015-08-31 14:26:21 +0300 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 03:03:26 +0300 |
commit | 1cb07eabec07b2315c8b26dd68566b8d105d867e (patch) | |
tree | 73f085ced04ab23b434bb19312be3d3df591bce0 /routing/router_delegate.hpp | |
parent | b375c33e3a313d17e8f1cfe7887c3b26d5853d3f (diff) |
Sinhronization mutex in router delegate.
Diffstat (limited to 'routing/router_delegate.hpp')
-rw-r--r-- | routing/router_delegate.hpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/routing/router_delegate.hpp b/routing/router_delegate.hpp index 42c892ad95..be87acbec4 100644 --- a/routing/router_delegate.hpp +++ b/routing/router_delegate.hpp @@ -6,6 +6,7 @@ #include "base/timer.hpp" #include "std/function.hpp" +#include "std/mutex.hpp" namespace routing { @@ -35,13 +36,16 @@ public: RouterDelegate(); /// Set routing progress. Waits current progress status from 0 to 100. - void OnProgress(float progress) const { if (!IsCancelled()) m_progressCallback(progress); } - void OnPointCheck(m2::PointD const & point) const { if (!IsCancelled()) m_pointCallback(point); } + void OnProgress(float progress) const; + void OnPointCheck(m2::PointD const & point) const; void SetProgressCallback(TProgressCallback const & progressCallback); void SetPointCheckCallback(TPointCheckCallback const & pointCallback); + void Reset() override {lock_guard<mutex> l(m_guard); TimeoutCancellable::Reset();} + private: + mutable mutex m_guard; TProgressCallback m_progressCallback; TPointCheckCallback m_pointCallback; }; |