Fix alarmmgr_add_alarm_withcb_precision api. 73/105173/1 accepted/tizen/3.0/common/20161219.113520 accepted/tizen/3.0/ivi/20161219.071457 accepted/tizen/3.0/tv/20161219.074320 accepted/tizen/3.0/wearable/20161219.095502 submit/tizen_3.0/20161216.082724
authorJiwoong Im <jiwoong.im@samsung.com>
Fri, 16 Dec 2016 01:49:29 +0000 (10:49 +0900)
committerJiwoong Im <jiwoong.im@samsung.com>
Fri, 16 Dec 2016 01:49:29 +0000 (10:49 +0900)
- 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>
include/alarm.h
src/alarm-lib.c

index 2490bfb..2124e9f 100644 (file)
@@ -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);
index 8fbe817..93a3233 100644 (file)
@@ -205,10 +205,12 @@ static void __handle_expiry_method_call(GDBusConnection *conn,
                        if (info->msec > 0) {
                                gettimeofday(&current_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);