From d9d88e7032e22d781368cbf1889099def17b757d Mon Sep 17 00:00:00 2001 From: tchernobog Date: Wed, 6 Sep 2006 08:46:06 +0000 Subject: [PATCH] - Put Simulation in stopped state before changing policy (doesn't prevent a sigsegv if you try to change it while the simulation is running) - Use a red color to indicate a blocked thread / unallocable request in widgets - TODO: try the deadlock test w/ the rr (NOT the rr_priority) cpu policy. There's something wrong with the policy... git-svn-id: svn://svn.gna.org/svn/sgpemv2/trunk@1019 3ecf2c5c-341e-0410-92b4-d18e462d057c --- src/backend/concrete_simulation.cc | 5 ++++- src/holt_widget.cc | 10 +++++----- src/simulation_widget.cc | 6 +++--- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/backend/concrete_simulation.cc b/src/backend/concrete_simulation.cc index 8ae3847..55650cd 100644 --- a/src/backend/concrete_simulation.cc +++ b/src/backend/concrete_simulation.cc @@ -209,10 +209,12 @@ ConcreteSimulation::get_history() const void ConcreteSimulation::set_policy(CPUPolicy* p) throw(CPUPolicyException) { + stop(); + // NOTE: restoring of the previous policy is done here because I // couldn't think of a clean way to do it // inside activate_policy() - + try { CPUPoliciesGatekeeper::get_instance().activate_policy(&_history, p); @@ -253,6 +255,7 @@ ConcreteSimulation::get_policy() void ConcreteSimulation::set_resource_policy(ResourcePolicy* p) { + stop(); ResourcePoliciesGatekeeper::get_instance().activate_policy(&_history, p); _resource_policy = p; } diff --git a/src/holt_widget.cc b/src/holt_widget.cc index 940a3c9..84da713 100644 --- a/src/holt_widget.cc +++ b/src/holt_widget.cc @@ -208,9 +208,9 @@ void HoltSchedulable::draw(cairo_t *cr) break; case Schedulable::state_blocked: // cairo_set_source_rgb (cr, 1, 0, 0); - // blue - cairo_pattern_add_color_stop_rgba(gradient, 0.00, 0.5, 0.5, 1.0, 0.7); - cairo_pattern_add_color_stop_rgba(gradient, 1.00, 0.0, 0.0, 1.0, 1.0); + // red + cairo_pattern_add_color_stop_rgba(gradient, 0.00, 1.0, 0.5, 0.5, 0.7); + cairo_pattern_add_color_stop_rgba(gradient, 1.00, 1.0, 0.0, 0.0, 1.0); cairo_set_source(cr, gradient); break; case Schedulable::state_future: @@ -276,8 +276,8 @@ void HoltRequest::draw(cairo_t *cr) switch(_state) { case Request::state_unallocable: - // blue - cairo_set_source_rgb(cr, 0, 0, 1); + // red + cairo_set_source_rgb(cr, 1, 0, 0); arrow(cr, schedulable, resource); break; case Request::state_allocated: diff --git a/src/simulation_widget.cc b/src/simulation_widget.cc index 452ce76..44709df 100644 --- a/src/simulation_widget.cc +++ b/src/simulation_widget.cc @@ -703,8 +703,8 @@ SimulationWidget::make_gradients() cairo_pattern_add_color_stop_rgba(_running_process_gradient, 1.00, 0.0, 1.0, 0.0, 1.0); _blocked_process_gradient = cairo_pattern_create_linear(0, 0, 0, _yu_process_bar_height * _y_unit); - // blue - cairo_pattern_add_color_stop_rgba(_blocked_process_gradient, 0.00, 0.5, 0.5, 1.0, 0.7); - cairo_pattern_add_color_stop_rgba(_blocked_process_gradient, 1.00, 0.0, 0.0, 1.0, 1.0); + // red + cairo_pattern_add_color_stop_rgba(_blocked_process_gradient, 0.00, 1.0, 0.5, 0.5, 0.7); + cairo_pattern_add_color_stop_rgba(_blocked_process_gradient, 1.00, 1.0, 0.0, 0.0, 1.0); }