Manager: show task running state correctly (fix last commits)

This commit is contained in:
David Anderson 2015-03-10 23:14:01 -07:00
parent a4e320b1a1
commit b490549af7
2 changed files with 31 additions and 11 deletions

View File

@ -2500,16 +2500,10 @@ wxString result_description(RESULT* result, bool show_resources) {
strBuffer += _("Project suspended by user");
} else if (result->suspended_via_gui) {
strBuffer += _("Task suspended by user");
// do this check before the following because (if dont_suspend_nci is set)
// an NCI task may be running even if computation suspended
//
} else if (result->active_task && result->scheduler_state == CPU_SCHED_SCHEDULED) {
strBuffer += _("Running");
if (project && project->non_cpu_intensive) {
strBuffer += _(" (non-CPU-intensive)");
}
} else if (status.task_suspend_reason && !throttled) {
} else if (status.task_suspend_reason && !throttled && result->active_task_state != PROCESS_EXECUTING) {
// an NCI process can be running even though computation is suspended
// (because of <dont_suspend_nci>
//
strBuffer += _("Suspended - ");
strBuffer += suspend_reason_wxstring(status.task_suspend_reason);
} else if (status.gpu_suspend_reason && uses_gpu(result)) {
@ -2520,6 +2514,11 @@ wxString result_description(RESULT* result, bool show_resources) {
strBuffer += _("Waiting for memory");
} else if (result->needs_shmem) {
strBuffer += _("Waiting for shared memory");
} else if (result->scheduler_state == CPU_SCHED_SCHEDULED) {
strBuffer += _("Running");
if (project && project->non_cpu_intensive) {
strBuffer += _(" (non-CPU-intensive)");
}
} else if (result->scheduler_state == CPU_SCHED_PREEMPTED) {
strBuffer += _("Waiting to run");
} else if (result->scheduler_state == CPU_SCHED_UNINITIALIZED) {

View File

@ -1148,7 +1148,28 @@ void CSimpleTaskPanel::UpdateTaskSelectionList(bool reskin) {
bool CSimpleTaskPanel::isRunning(RESULT* result) {
return (result->scheduler_state == CPU_SCHED_SCHEDULED);
// It must be scheduled to be running
if ( result->scheduler_state != CPU_SCHED_SCHEDULED ) {
return false;
}
// If either the project or task have been suspended, then it cannot be running
if (result->suspended_via_gui || result->project_suspended_via_gui ) {
return false;
}
CC_STATUS status;
CMainDocument* pDoc = wxGetApp().GetDocument();
wxASSERT(pDoc);
pDoc->GetCoreClientStatus(status);
// Make sure that the core client isn't global suspended for some reason
if (status.task_suspend_reason == 0 || status.task_suspend_reason == SUSPEND_REASON_CPU_THROTTLE) {
return true;
}
if (result->active_task_state == PROCESS_EXECUTING) {
return true;
}
return false;
}