diff options
author | Jiwoong Im <jiwoong.im@samsung.com> | 2016-12-16 10:49:29 +0900 |
---|---|---|
committer | Jiwoong Im <jiwoong.im@samsung.com> | 2017-01-05 07:47:40 +0900 |
commit | 6c8504d9772dc32dc3920ffce6f68b19af025094 (patch) | |
tree | 0661a57a8707a4ee817faf3a40ee771339374e5e | |
parent | 0e1f836ff95358e16ae57bcca10eb7ead44f0523 (diff) | |
download | alarm-manager-6c8504d9772dc32dc3920ffce6f68b19af025094.tar.gz alarm-manager-6c8504d9772dc32dc3920ffce6f68b19af025094.tar.bz2 alarm-manager-6c8504d9772dc32dc3920ffce6f68b19af025094.zip |
Fix alarmmgr_add_alarm_withcb_precision api.
- Change priority in g_timeout_add to G_PRIORITY_HIGH.
Modify alarmmgr_add_alarm_withcb_precision description.
Change-Id: I8351c5c508f495cac44acfa96cbe68e3caf84ca5
Signed-off-by: Jiwoong Im <jiwoong.im@samsung.com>
-rw-r--r-- | include/alarm.h | 3 | ||||
-rw-r--r-- | src/alarm-lib.c | 8 |
2 files changed, 8 insertions, 3 deletions
diff --git a/include/alarm.h b/include/alarm.h index 2490bfb..2124e9f 100644 --- a/include/alarm.h +++ b/include/alarm.h @@ -1629,6 +1629,9 @@ int alarmmgr_add_alarm_withcb(int alarm_type, time_t trigger_at_time, * @retval #ERR_ALARM_NO_PERMISSION Permission error * @remark When a process which registered an alarm is killed, the callback @c handler will not be used. * In this case, calling the @c alarmmgr_set_cb() can register a callback again. + * The callback function may be delayed, due to the processing of other event. + * This function corrects the delay as much as possible. + * */ int alarmmgr_add_alarm_withcb_precision(int alarm_type, time_t trigger_at_time, time_t interval, alarm_cb_t handler, void *user_param, alarm_id_t *alarm_id); diff --git a/src/alarm-lib.c b/src/alarm-lib.c index 8fbe817..93a3233 100644 --- a/src/alarm-lib.c +++ b/src/alarm-lib.c @@ -205,10 +205,12 @@ static void __handle_expiry_method_call(GDBusConnection *conn, if (info->msec > 0) { gettimeofday(¤t_time, NULL); msec = info->msec - current_time.tv_usec / 1000; - if (msec > 0) - g_timeout_add((guint)msec, __handle_millisec_accuracy, info); - else + if (msec > 0) { + g_timeout_add_full(G_PRIORITY_HIGH, (guint)msec, + __handle_millisec_accuracy, info, NULL); + } else { info->cb_func(alarm_id, info->priv_data); + } } else { ALARM_MGR_EXCEPTION_PRINT("[alarm-lib] Call expired callback"); info->cb_func(alarm_id, info->priv_data); |