return G_SOURCE_CONTINUE;
}
+ if (cpc->timer) {
+ g_source_remove(cpc->timer);
+ cpc->timer = 0;
+ }
+
_get_cpu_idle(&total, &idle);
cpc->cpu_idle_time = idle;
cpc->cpu_total_time = total;
return G_SOURCE_CONTINUE;
}
-static int __sequencer_add_slot(candidate_process_context_t *cpc)
+static bool __sequencer_slot_is_running(candidate_process_context_t *cpc)
+{
+ GSource *source;
+ guint source_id;
+
+ source = g_main_context_find_source_by_funcs_user_data(NULL,
+ (GSourceFuncs *)__handle_idle_checker, (gpointer)cpc);
+ if (source) {
+ source_id = g_source_get_id(source);
+ if (source_id != 0 && source_id == __sequencer.idle_checker)
+ return true;
+ }
+
+ return false;
+}
+
+static bool __sequencer_slot_exist(candidate_process_context_t *cpc)
{
GList *found;
found = g_queue_find(__sequencer.queue, cpc);
- if (found) {
+ if (found)
+ return true;
+
+ return false;
+}
+
+static int __sequencer_add_slot(candidate_process_context_t *cpc)
+{
+ if (__sequencer_slot_exist(cpc)) {
_W("Already exists");
return -1;
}
+ if (__sequencer_slot_is_running(cpc)) {
+ _W("slot(%d) is running", cpc->type);
+ return -1;
+ }
+
g_queue_push_tail(__sequencer.queue, cpc);
return 0;
cpc = (candidate_process_context_t *)user_data;
cpc->timer = 0;
+ if (cpc->pid != CANDIDATE_NONE) {
+ _W("Candidate(%d) process(%d) is running", cpc->type, cpc->pid);
+ return G_SOURCE_REMOVE;
+ }
+
__sequencer_add_slot(cpc);
__sequencer_run();
return G_SOURCE_REMOVE;
pid = __launch_directly(menu_info->appid, app_path, clifd, kb,
menu_info, NULL);
if (org_cpc && org_cpc->app_exists &&
- org_cpc->pid == CANDIDATE_NONE) {
+ org_cpc->pid == CANDIDATE_NONE &&
+ !__sequencer_slot_exist(org_cpc)) {
if (org_cpc->timer > 0) {
g_source_remove(org_cpc->timer);
org_cpc->timer = 0;