diff options
author | Kevin Tang <zhikait@codeaurora.org> | 2015-07-20 15:36:06 -0700 |
---|---|---|
committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2015-08-10 10:33:49 -0700 |
commit | 898c646a7c64e1f8b00a31ea5bffd723c87dddd9 (patch) | |
tree | ab981294cce5fc0b92b41ba7fde1b8a63fd8ec28 /utils/loc_timer.h | |
parent | 277f3e30a3214d8370848cb75a1550521eb6fbaf (diff) | |
download | gps-898c646a7c64e1f8b00a31ea5bffd723c87dddd9.tar.gz |
crash in LocTimer wrapper
LocTimerWrapper implements loc_timer_start/stop calls for backward
compatibility. There is a race condtiion where the wrapper object
could be deleted by the client thread and expireation handling at
rough the same time, which would have the memory freed twice. Now
they are mutext protected.
Change-Id: I25d7466db88a840a8a09e7a476cface48c91d22e
Diffstat (limited to 'utils/loc_timer.h')
-rw-r--r-- | utils/loc_timer.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/utils/loc_timer.h b/utils/loc_timer.h index 8836d1e..2967858 100644 --- a/utils/loc_timer.h +++ b/utils/loc_timer.h @@ -45,7 +45,8 @@ typedef void (*loc_timer_callback)(void *user_data, int32_t result); /* delay_msec: timeout value for the timer. - loc_timer_callback: callback function pointer, implemented by client. + cb_func: callback function pointer, implemented by client. + Can not be NULL. 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 @@ -53,9 +54,10 @@ typedef void (*loc_timer_callback)(void *user_data, int32_t result); 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 + NULL, if timer start fails (e.g. if cb_func is NULL). */ void* loc_timer_start(uint64_t delay_msec, - loc_timer_callback, + loc_timer_callback cb_func, void *user_data, bool wake_on_expire=false); |