summaryrefslogtreecommitdiff
path: root/core/LocAdapterBase.cpp
diff options
context:
space:
mode:
authorWei Chen <weic@codeaurora.org>2019-10-01 14:18:29 -0700
committerWei Chen <weic@codeaurora.org>2019-10-01 15:58:34 -0700
commit4df22b2e6bd37b53ebf5610282e4a666032e4879 (patch)
treee12321e3480074d1958c32237e4d71974d0e8df5 /core/LocAdapterBase.cpp
parent331b2296241ee723fd806c9e0e228e6b60a4cc23 (diff)
GNSS adapter: fix a race condition
Fix the race condition that handleEngineUp gets called before GNSS adapter constructor finishes CRs-fixed: 2538904 Change-Id: I0946dd44ce3a4b03f2c8a45a855bbfbd4b7b8468
Diffstat (limited to 'core/LocAdapterBase.cpp')
-rw-r--r--core/LocAdapterBase.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/core/LocAdapterBase.cpp b/core/LocAdapterBase.cpp
index 266c10e..c669c03 100644
--- a/core/LocAdapterBase.cpp
+++ b/core/LocAdapterBase.cpp
@@ -43,12 +43,19 @@ namespace loc_core {
// the right locApi should get created.
LocAdapterBase::LocAdapterBase(const LOC_API_ADAPTER_EVENT_MASK_T mask,
ContextBase* context, bool isMaster,
- LocAdapterProxyBase *adapterProxyBase) :
+ LocAdapterProxyBase *adapterProxyBase,
+ bool waitForDoneInit) :
mIsMaster(isMaster), mEvtMask(mask), mContext(context),
mLocApi(context->getLocApi()), mLocAdapterProxyBase(adapterProxyBase),
mMsgTask(context->getMsgTask())
{
- mLocApi->addAdapter(this);
+ LOC_LOGd("waitForDoneInit: %d", waitForDoneInit);
+ if (!waitForDoneInit) {
+ mLocApi->addAdapter(this);
+ mAdapterAdded = true;
+ } else {
+ mAdapterAdded = false;
+ }
}
uint32_t LocAdapterBase::mSessionIdCounter(1);