diff options
author | Kevin Tang <zhikait@codeaurora.org> | 2015-09-11 19:40:25 -0700 |
---|---|---|
committer | Kevin Tang <zhikait@codeaurora.org> | 2015-09-21 14:45:58 -0700 |
commit | 94ecbf68045cb44f6b6287621007ac845ed88ee2 (patch) | |
tree | 238cfd22f18ec89b97d1342d8276cc61fb716fa5 /utils/LocTimer.cpp | |
parent | 049cc84d3a9df23f92fda74845c5f4dd95507c23 (diff) | |
download | gps-94ecbf68045cb44f6b6287621007ac845ed88ee2.tar.gz |
Crash fix with MsgTask API change
Removed tCreate and tAssociate from MsgTask. LocThread
now can optionally take a tCreate method. Associator is
replaced with *firstMsg* option to MsgTask, which is a
more generic option, that can associate or do other set
up job at the create of a MsgTask.
The current MsgTask doesn't use tCreate, which exposes
a slight time window for Location HAL when its MsgTask
is NOT associated to DVM heap but a message delivery to
DVM could be attempted during this time.
Change-Id: Iafd5b91b693baacb9b7064463f8c44f74026f54c
CRs-Fixed: 902350
Diffstat (limited to 'utils/LocTimer.cpp')
-rw-r--r-- | utils/LocTimer.cpp | 22 |
1 files changed, 3 insertions, 19 deletions
diff --git a/utils/LocTimer.cpp b/utils/LocTimer.cpp index 0f698c5..c992e7c 100644 --- a/utils/LocTimer.cpp +++ b/utils/LocTimer.cpp @@ -37,7 +37,7 @@ #include <LocTimer.h> #include <LocHeap.h> #include <LocThread.h> -#include <pthread.h> +#include <LocSharedLock.h> #include <MsgTask.h> #ifdef __HOST_UNIT_TEST__ @@ -46,22 +46,6 @@ #define CLOCK_BOOTTIME_ALARM CLOCK_MONOTONIC #endif -using namespace loc_core; - -// a shared lock until, place it here for now. -class LocUtilSharedLock { - uint32_t mRef; - pthread_mutex_t mMutex; - inline ~LocUtilSharedLock() { pthread_mutex_destroy(&mMutex); } -public: - inline LocUtilSharedLock() : mRef(1) { pthread_mutex_init(&mMutex, NULL); } - inline LocUtilSharedLock* share() { mRef++; return this; } - inline void drop() { if (0 == --mRef) delete this; } - inline void lock() { pthread_mutex_lock(&mMutex); } - inline void unlock() { pthread_mutex_unlock(&mMutex); } -}; - - /* There are implementations of 5 classes in this file: LocTimer, LocTimerDelegate, LocTimerContainer, LocTimerPollTask, LocTimerWrapper @@ -191,7 +175,7 @@ class LocTimerDelegate : public LocRankable { friend class LocTimerContainer; friend class LocTimer; LocTimer* mClient; - LocUtilSharedLock* mLock; + LocSharedLock* mLock; struct timespec mFutureTime; LocTimerContainer* mContainer; // not a complete obj, just ctor for LocRankable comparisons @@ -548,7 +532,7 @@ void LocTimerDelegate::expire() { /***************************LocTimer methods***************************/ -LocTimer::LocTimer() : mTimer(NULL), mLock(new LocUtilSharedLock()) { +LocTimer::LocTimer() : mTimer(NULL), mLock(new LocSharedLock()) { } LocTimer::~LocTimer() { |