- Now a thread is automatically added to a newly created process
git-svn-id: svn://svn.gna.org/svn/sgpemv2/trunk@1320 3ecf2c5c-341e-0410-92b4-d18e462d057c
This commit is contained in:
parent
9481d322c7
commit
3ec038e3d8
2 changed files with 205 additions and 280 deletions
|
@ -316,29 +316,13 @@ SchedulablesTreeWidget::update(const History& history)
|
|||
|
||||
TreeModel::Row rrow = *(_model->append(trow.children()));
|
||||
|
||||
// std::ostringstream oss;
|
||||
// oss << _("request ") << ri + 1;
|
||||
// std::ostringstream oss;
|
||||
// oss << _("request ") << ri + 1;
|
||||
|
||||
// rrow[_main_column] = oss.str();
|
||||
// rrow[_main_column] = oss.str();
|
||||
rrow[_types_column] = htype_request;
|
||||
rrow[_handles_column] = &r;
|
||||
|
||||
// vector<SubRequest*> subrequests = r.get_subrequests();
|
||||
//
|
||||
// for(Iseq<vector<SubRequest*>::iterator> srit = iseq(subrequests); srit; ++srit)
|
||||
// {
|
||||
// SubRequest& sr = *(*srit);
|
||||
//
|
||||
// TreeModel::Row srrow = *(_model->append(rrow.children()));
|
||||
//
|
||||
// // we are sure the key is valid, or no?
|
||||
// const Environment& env = history.get_last_environment();
|
||||
// Resource& res = *(env.get_resources().find(sr.get_resource_key())->second);
|
||||
//
|
||||
// srrow[_main_column] = res.get_name();
|
||||
// srrow[_types_column] = htype_subrequest;
|
||||
// srrow[_handles_column] = &sr;
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -378,10 +362,12 @@ SchedulablesTreeWidget::add_edit_process(bool adding)
|
|||
|
||||
Entry* name_entry;
|
||||
SpinButton* arrival_time_spin;
|
||||
SpinButton* duration_spin;
|
||||
SpinButton* base_priority_spin;
|
||||
|
||||
glade->get_widget("Name.Entry", name_entry);
|
||||
glade->get_widget("ArrivalTime.Spin", arrival_time_spin);
|
||||
glade->get_widget("Duration.Spin", duration_spin);
|
||||
glade->get_widget("BasePriority.Spin", base_priority_spin);
|
||||
|
||||
Process* selection = NULL;
|
||||
|
@ -392,32 +378,35 @@ SchedulablesTreeWidget::add_edit_process(bool adding)
|
|||
|
||||
name_entry->set_text(selection->get_name());
|
||||
arrival_time_spin->set_value(static_cast<double>(selection->get_arrival_time()));
|
||||
duration_spin->set_value(static_cast<double>(selection->get_total_cpu_time()));
|
||||
duration_spin->set_sensitive(false);
|
||||
base_priority_spin->set_value(static_cast<double>(selection->get_base_priority()));
|
||||
}
|
||||
// else
|
||||
// {
|
||||
// name_entry->set_text("");
|
||||
// arrival_time_spin->set_value(0.0);
|
||||
// base_priority_spin->set_value(0.0);
|
||||
// }
|
||||
|
||||
|
||||
if(add_process_dialog->run() == RESPONSE_OK)
|
||||
{
|
||||
|
||||
if(adding)
|
||||
{
|
||||
Simulation::get_instance().get_history().add_process(name_entry->get_text(),
|
||||
arrival_time_spin->get_value_as_int(),
|
||||
base_priority_spin->get_value_as_int());
|
||||
}
|
||||
{
|
||||
History& h = Simulation::get_instance().get_history();
|
||||
History::LockNotify lock(h);
|
||||
|
||||
Process& np = h.add_process(name_entry->get_text(),
|
||||
arrival_time_spin->get_value_as_int(),
|
||||
base_priority_spin->get_value_as_int());
|
||||
|
||||
h.add_thread(_("Main"), np, duration_spin->get_value_as_int(),
|
||||
0, base_priority_spin->get_value_as_int());
|
||||
}
|
||||
else
|
||||
{
|
||||
Simulation::get_instance().get_history().edit_process(*selection,
|
||||
name_entry->get_text(),
|
||||
arrival_time_spin->get_value_as_int(),
|
||||
base_priority_spin->get_value_as_int());
|
||||
}
|
||||
{
|
||||
History& h = Simulation::get_instance().get_history();
|
||||
History::LockNotify lock(h);
|
||||
|
||||
h.edit_process(*selection,
|
||||
name_entry->get_text(),
|
||||
arrival_time_spin->get_value_as_int(),
|
||||
base_priority_spin->get_value_as_int());
|
||||
}
|
||||
}
|
||||
|
||||
add_process_dialog->hide();
|
||||
|
@ -467,13 +456,6 @@ SchedulablesTreeWidget::add_edit_thread(bool adding)
|
|||
arrival_time_spin->set_value(static_cast<double>(t->get_arrival_time()));
|
||||
base_priority_spin->set_value(static_cast<double>(t->get_base_priority()));
|
||||
}
|
||||
// else
|
||||
// {
|
||||
// name_entry->set_text("");
|
||||
// cpu_time_spin->set_value(1.0);
|
||||
// arrival_time_spin->set_value(0.0);
|
||||
// base_priority_spin->set_value(0.0);
|
||||
// }
|
||||
|
||||
|
||||
if(add_thread_dialog->run() == RESPONSE_OK)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue