return NULL;
}
-static void __pause_last_running_slot(bool is_hydra)
+static void __pause_all_running_slots(bool is_hydra)
{
candidate_process_context_t *cpc = NULL;
GList *iter;
iter = g_list_last(candidate_slot_list);
while (iter) {
cpc = (candidate_process_context_t *)iter->data;
- if (cpc->is_hydra == is_hydra && cpc->pid != CANDIDATE_NONE)
- break;
+ if (cpc->is_hydra == is_hydra && cpc->pid != CANDIDATE_NONE) {
+ __update_slot_state(cpc, METHOD_OUT_OF_MEMORY, true);
+ if (!_memory_monitor_is_low_memory())
+ return;
+ }
iter = g_list_previous(iter);
}
-
- if (!cpc)
- return;
-
- __update_slot_state(cpc, METHOD_OUT_OF_MEMORY, true);
}
static void __resume_all_slots(void)
candidate_slot_list = g_list_sort(candidate_slot_list,
__compare_slot);
-
- do {
- __pause_last_running_slot(false);
-
- cpc = __get_running_slot(false);
- if (!cpc)
- break;
- } while (__is_low_memory());
+ __pause_all_running_slots(false);
} else {
__resume_all_slots();
}