return 0;
}
-static gboolean __handle_exec_loader_process(gpointer user_data)
-{
- candidate_process_context_t *cpt;
- candidate_info_t *info = user_data;
-
- _W("Candidate process. type: %d, loader_id: %d, pid: %d",
- info->type, info->loader_id, info->pid);
- if (info->pid > 0) {
- cpt = __find_slot(info->type, info->loader_id);
- cpt->last_exec_time = time(NULL);
- if (cpt->is_hydra) {
- cpt->hydra_pid = info->pid;
- } else {
- cpt->pid = info->pid;
- __set_live_timer(cpt);
- }
-
- _log_print("[CANDIDATE]", "pid(%7d) | type(%d) | loader(%s)",
- info->pid, cpt->loader_id, cpt->loader_name);
- _memory_monitor_reset_timer();
- }
-
- __candidate_info_free(info);
- return G_SOURCE_REMOVE;
-}
-
-static bool __exec_loader_process_cb(void *user_data)
-{
- candidate_info_t *info = user_data;
-
- if (info == NULL)
- return false;
-
- info->pid = __fork_app_process(__exec_loader_process, info->argv);
- if (info->pid == -1)
- _E("Failed to create a child process");
-
- g_idle_add(__handle_exec_loader_process, info);
- return false;
-}
-
static int __prepare_candidate_process(int type, int loader_id)
{
candidate_process_context_t *cpt = __find_slot(type, loader_id);
if (ret < 0)
return ret;
- ret = _worker_add_job(__forker, __exec_loader_process_cb, info);
- if (ret != 0) {
- _E("_worker_add_job() is failed");
+ info->pid = __fork_app_process(__exec_loader_process, info->argv);
+ if (info->pid == -1) {
+ _E("Failed to create a child process. type: %d", type);
__candidate_info_free(info);
return -1;
}
+ _W("Candidate process. type: %d, loader_id: %d, pid: %d",
+ info->type, info->loader_id, info->pid);
+ cpt = __find_slot(info->type, info->loader_id);
+ cpt->last_exec_time = time(NULL);
+ if (cpt->is_hydra) {
+ cpt->hydra_pid = info->pid;
+ } else {
+ cpt->pid = info->pid;
+ __set_live_timer(cpt);
+ }
+
+ _log_print("[CANDIDATE]", "pid(%7d) | type(%d) | loader(%s)",
+ info->pid, cpt->loader_id, cpt->loader_name);
+ _memory_monitor_reset_timer();
+ __candidate_info_free(info);
return 0;
}