forked from organicmaps/organicmaps
Correct ThreadChecker fix.
This commit is contained in:
parent
b3bf7f96e8
commit
86d1bf8389
2 changed files with 14 additions and 8 deletions
|
@ -78,7 +78,7 @@ void DeferredTask::WaitForCompletion()
|
|||
|
||||
void DeferredTask::CheckContext() const
|
||||
{
|
||||
#if defined(DEBUG) && defined(OMIM_OS_ANDROID)
|
||||
#ifdef USE_THREAD_CHECKER
|
||||
CHECK(m_threadChecker.CalledOnOriginalThread(), ());
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -4,15 +4,23 @@
|
|||
#include "base/macros.hpp"
|
||||
#include "base/thread.hpp"
|
||||
|
||||
#ifndef OMIM_OS_ANDROID
|
||||
#include "base/thread_checker.hpp"
|
||||
#endif
|
||||
|
||||
#include "std/chrono.hpp"
|
||||
#include "std/condition_variable.hpp"
|
||||
#include "std/function.hpp"
|
||||
#include "std/unique_ptr.hpp"
|
||||
|
||||
|
||||
#if defined(DEBUG) && !defined(OMIM_OS_ANDROID)
|
||||
// This checker is not valid on Android.
|
||||
// UI thread (NV thread) can change it's handle value during app lifecycle.
|
||||
#define USE_THREAD_CHECKER
|
||||
#endif
|
||||
|
||||
#ifdef USE_THREAD_CHECKER
|
||||
#include "base/thread_checker.hpp"
|
||||
#endif
|
||||
|
||||
|
||||
// This class is used to call a function after waiting for a specified
|
||||
// amount of time. The function is called in a separate thread. This
|
||||
// class is not thread safe.
|
||||
|
@ -57,9 +65,7 @@ private:
|
|||
atomic<bool> m_started;
|
||||
threads::Thread m_thread;
|
||||
|
||||
#if defined(DEBUG) && defined(OMIM_OS_ANDROID)
|
||||
// This checker is not valid on Android.
|
||||
// UI thread (NV thread) can change it's handle value during app lifecycle.
|
||||
#ifdef USE_THREAD_CHECKER
|
||||
ThreadChecker m_threadChecker;
|
||||
#endif
|
||||
void CheckContext() const;
|
||||
|
|
Loading…
Add table
Reference in a new issue