summaryrefslogtreecommitdiff
path: root/utils/LocThread.h
diff options
context:
space:
mode:
authorKevin Tang <zhikait@codeaurora.org>2015-09-11 19:40:25 -0700
committerKevin Tang <zhikait@codeaurora.org>2015-09-21 14:45:58 -0700
commit94ecbf68045cb44f6b6287621007ac845ed88ee2 (patch)
tree238cfd22f18ec89b97d1342d8276cc61fb716fa5 /utils/LocThread.h
parent049cc84d3a9df23f92fda74845c5f4dd95507c23 (diff)
downloadgps-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/LocThread.h')
-rw-r--r--utils/LocThread.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/utils/LocThread.h b/utils/LocThread.h
index 490d309..2a65d8f 100644
--- a/utils/LocThread.h
+++ b/utils/LocThread.h
@@ -30,6 +30,7 @@
#define __LOC_THREAD__
#include <stddef.h>
+#include <pthread.h>
// abstract class to be implemented by client to provide a runnable class
// which gets scheduled by LocThread
@@ -64,6 +65,7 @@ public:
inline LocThread() : mThread(NULL) {}
virtual ~LocThread();
+ typedef pthread_t (*tCreate)(const char* name, void* (*start)(void*), void* arg);
// client starts thread with a runnable, which implements
// the logics to fun in the created thread context.
// The thread could be either joinable or detached.
@@ -74,7 +76,10 @@ public:
// returns true. Else it is client's responsibility
// to delete the object
// Returns 0 if success; false if failure.
- bool start(const char* threadName, LocRunnable* runnable, bool joinable = true);
+ bool start(tCreate creator, const char* threadName, LocRunnable* runnable, bool joinable = true);
+ inline bool start(const char* threadName, LocRunnable* runnable, bool joinable = true) {
+ return start(NULL, threadName, runnable, joinable);
+ }
// NOTE: if this is a joinable thread, this stop may block
// for a while until the thread is joined.