summaryrefslogtreecommitdiff
path: root/utils/loc_timer.h
diff options
context:
space:
mode:
authorKevin Tang <zhikait@codeaurora.org>2015-06-16 09:57:42 -0700
committerGerrit - the friendly Code Review server <code-review@localhost>2015-08-04 14:29:48 -0700
commitbb5d2d4bfb12df717f35f3d2365ce0263d319fe7 (patch)
tree11bd1981dc486d76656bdd7632f5df2526f4fec0 /utils/loc_timer.h
parentd0faf18e26bdc4bfc38c164b3f3060843e443ba5 (diff)
downloadgps-bb5d2d4bfb12df717f35f3d2365ce0263d319fe7.tar.gz
Adding a number of utilities
LocHeap, LocThread, LocTimer, and moved MsgTask to utils. Also added are LocRankable and LocRunnable abstract classes. Change-Id: I76975455d24f2c84a95dcc1b04f79fea562ea5ba CRs-Fixed: 855222
Diffstat (limited to 'utils/loc_timer.h')
-rw-r--r--utils/loc_timer.h32
1 files changed, 20 insertions, 12 deletions
diff --git a/utils/loc_timer.h b/utils/loc_timer.h
index 0034d27..8836d1e 100644
--- a/utils/loc_timer.h
+++ b/utils/loc_timer.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2013, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2013,2015 The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -33,28 +33,36 @@
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
-#include<pthread.h>
-#include "log_util.h"
+#include <stddef.h>
/*
- Return values:
- Success = 0
- Failure = Non zero
+ user_data: client context pointer, passthrough. Originally received
+ from calling client when loc_timer_start() is called.
+ result: 0 if timer successfully timed out; else timer failed.
*/
-typedef void(*loc_timer_callback)(void *user_data, int result);
+typedef void (*loc_timer_callback)(void *user_data, int32_t result);
/*
- Returns the handle, which can be used to stop the timer
+ delay_msec: timeout value for the timer.
+ loc_timer_callback: callback function pointer, implemented by client.
+ user_data: client context pointer, passthrough. Will be
+ returned when loc_timer_callback() is called.
+ wakeOnExpire: true if to wake up CPU (if sleeping) upon timer
+ expiration and notify the client.
+ false if to wait until next time CPU wakes up (if
+ sleeping) and then notify the client.
+ Returns the handle, which can be used to stop the timer
*/
-void* loc_timer_start(unsigned int delay_msec,
+void* loc_timer_start(uint64_t delay_msec,
loc_timer_callback,
- void* user_data);
+ void *user_data,
+ bool wake_on_expire=false);
/*
- handle becomes invalid upon the return of the callback
+ handle becomes invalid upon the return of the callback
*/
-void loc_timer_stop(void* handle);
+void loc_timer_stop(void*& handle);
#ifdef __cplusplus
}