- Fix the st8ad_cast bug. Please report it has been fixed
with this revision number into the anomaly records. git-svn-id: svn://svn.gna.org/svn/sgpemv2/trunk@1200 3ecf2c5c-341e-0410-92b4-d18e462d057c
This commit is contained in:
parent
961bcf6dc6
commit
4ff9985ad5
|
@ -146,8 +146,6 @@ ConcreteHistory::remove(resource_key_t resource_key)
|
||||||
if (found == resources.end())
|
if (found == resources.end())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
reset(false);
|
|
||||||
|
|
||||||
delete found->second;
|
delete found->second;
|
||||||
resources.erase(found);
|
resources.erase(found);
|
||||||
|
|
||||||
|
@ -195,7 +193,7 @@ ConcreteHistory::remove(resource_key_t resource_key)
|
||||||
// for example. Or hangovers. Or being read poetry by a Vogon.
|
// for example. Or hangovers. Or being read poetry by a Vogon.
|
||||||
// Although the above construct really rates between the first tens.
|
// Although the above construct really rates between the first tens.
|
||||||
|
|
||||||
notify_change();
|
reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -207,7 +205,7 @@ ConcreteHistory::remove(Process& process)
|
||||||
ConcreteEnvironment::Processes& processes = initial.get_processes();
|
ConcreteEnvironment::Processes& processes = initial.get_processes();
|
||||||
bool found = deep_remove<Process>(processes, process);
|
bool found = deep_remove<Process>(processes, process);
|
||||||
if (found)
|
if (found)
|
||||||
reset(true);
|
reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -229,7 +227,7 @@ ConcreteHistory::remove(Thread& thread)
|
||||||
bool removed = deep_remove<DynamicThread>(dynamic_found.get_dynamic_threads(), dyn_thr);
|
bool removed = deep_remove<DynamicThread>(dynamic_found.get_dynamic_threads(), dyn_thr);
|
||||||
|
|
||||||
if (removed)
|
if (removed)
|
||||||
reset(true);
|
reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -255,7 +253,7 @@ ConcreteHistory::remove(Request& request)
|
||||||
bool removed = deep_remove<DynamicRequest>(thr_ref->get_dynamic_requests(), dyn_req);
|
bool removed = deep_remove<DynamicRequest>(thr_ref->get_dynamic_requests(), dyn_req);
|
||||||
|
|
||||||
if (removed)
|
if (removed)
|
||||||
reset(true);
|
reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -288,18 +286,16 @@ ConcreteHistory::remove(SubRequest& subrequest)
|
||||||
bool removed = deep_remove<DynamicSubRequest>(req_ref->get_dynamic_subrequests(), dyn_sub);
|
bool removed = deep_remove<DynamicSubRequest>(req_ref->get_dynamic_subrequests(), dyn_sub);
|
||||||
|
|
||||||
if (removed)
|
if (removed)
|
||||||
reset(true);
|
reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ConcreteHistory::clear()
|
ConcreteHistory::clear()
|
||||||
{
|
{
|
||||||
reset(false);
|
|
||||||
assert(_snapshots.size() == 1);
|
|
||||||
delete _snapshots.front();
|
delete _snapshots.front();
|
||||||
_snapshots.front() = new ConcreteEnvironment();
|
_snapshots.front() = new ConcreteEnvironment();
|
||||||
notify_change();
|
reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -309,8 +305,6 @@ ConcreteHistory::add_resource(const Glib::ustring& name,
|
||||||
size_t places,
|
size_t places,
|
||||||
size_t availability)
|
size_t availability)
|
||||||
{
|
{
|
||||||
reset(false);
|
|
||||||
|
|
||||||
typedef ConcreteEnvironment::Resources Resources;
|
typedef ConcreteEnvironment::Resources Resources;
|
||||||
typedef ConcreteEnvironment::SubRequestQueue SubRequestQueue;
|
typedef ConcreteEnvironment::SubRequestQueue SubRequestQueue;
|
||||||
// And preemptable and availability?? FIXME!
|
// And preemptable and availability?? FIXME!
|
||||||
|
@ -332,8 +326,7 @@ ConcreteHistory::add_resource(const Glib::ustring& name,
|
||||||
SubRequestQueue emptysrq;
|
SubRequestQueue emptysrq;
|
||||||
_snapshots.front()->get_subrequest_queues().insert(pair<resource_key_t, SubRequestQueue>(index, emptysrq));
|
_snapshots.front()->get_subrequest_queues().insert(pair<resource_key_t, SubRequestQueue>(index, emptysrq));
|
||||||
|
|
||||||
|
reset();
|
||||||
notify_change();
|
|
||||||
|
|
||||||
return *temp;
|
return *temp;
|
||||||
}
|
}
|
||||||
|
@ -353,7 +346,7 @@ ConcreteHistory::edit_resource(Resource& resource,
|
||||||
core.set_name(name);
|
core.set_name(name);
|
||||||
core.set_places(places);
|
core.set_places(places);
|
||||||
|
|
||||||
reset(true);
|
reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -362,15 +355,14 @@ ConcreteHistory::add_process(const Glib::ustring& name,
|
||||||
time_t arrival_time,
|
time_t arrival_time,
|
||||||
prio_t base_priority)
|
prio_t base_priority)
|
||||||
{
|
{
|
||||||
reset(false);
|
|
||||||
|
|
||||||
StaticProcess* core = new StaticProcess(name, arrival_time, base_priority);
|
StaticProcess* core = new StaticProcess(name, arrival_time, base_priority);
|
||||||
DynamicProcess* proc = new DynamicProcess(core);
|
DynamicProcess* proc = new DynamicProcess(core);
|
||||||
|
|
||||||
ConcreteEnvironment::Processes& processes = _snapshots.front()->get_processes();
|
ConcreteEnvironment::Processes& processes = _snapshots.front()->get_processes();
|
||||||
processes.push_back(proc);
|
processes.push_back(proc);
|
||||||
|
|
||||||
notify_change();
|
reset();
|
||||||
|
|
||||||
return *proc;
|
return *proc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -387,7 +379,7 @@ ConcreteHistory::edit_process(Process& process,
|
||||||
core.set_arrival_time(arrival_time);
|
core.set_arrival_time(arrival_time);
|
||||||
core.set_priority(base_priority);
|
core.set_priority(base_priority);
|
||||||
|
|
||||||
reset(true);
|
reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -399,14 +391,13 @@ ConcreteHistory::add_thread(const Glib::ustring& name,
|
||||||
time_t arrival_time,
|
time_t arrival_time,
|
||||||
prio_t base_priority)
|
prio_t base_priority)
|
||||||
{
|
{
|
||||||
reset(false);
|
|
||||||
|
|
||||||
DynamicProcess& parent_process = down_cast<DynamicProcess&>(parent);
|
DynamicProcess& parent_process = down_cast<DynamicProcess&>(parent);
|
||||||
StaticProcess& parent_core = parent_process.get_core();
|
StaticProcess& parent_core = parent_process.get_core();
|
||||||
StaticThread* core = new StaticThread(name, parent_core, cpu_time, arrival_time, base_priority);
|
StaticThread* core = new StaticThread(name, parent_core, cpu_time, arrival_time, base_priority);
|
||||||
DynamicThread* thread = new DynamicThread(core, &parent_process);
|
DynamicThread* thread = new DynamicThread(core, &parent_process);
|
||||||
|
|
||||||
notify_change();
|
reset();
|
||||||
|
|
||||||
return *thread;
|
return *thread;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -424,15 +415,13 @@ ConcreteHistory::edit_thread(Thread& thread,
|
||||||
core.set_arrival_time(arrival_time);
|
core.set_arrival_time(arrival_time);
|
||||||
core.set_priority(base_priority);
|
core.set_priority(base_priority);
|
||||||
|
|
||||||
reset(true);
|
reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
DynamicRequest&
|
DynamicRequest&
|
||||||
ConcreteHistory::add_request(Thread& owner,
|
ConcreteHistory::add_request(Thread& owner,
|
||||||
time_t instant)
|
time_t instant)
|
||||||
{
|
{
|
||||||
reset(false);
|
|
||||||
|
|
||||||
DynamicThread& dyn_owner = down_cast<DynamicThread&>(owner);
|
DynamicThread& dyn_owner = down_cast<DynamicThread&>(owner);
|
||||||
StaticThread& owner_core = dyn_owner.get_core();
|
StaticThread& owner_core = dyn_owner.get_core();
|
||||||
|
|
||||||
|
@ -441,7 +430,8 @@ ConcreteHistory::add_request(Thread& owner,
|
||||||
|
|
||||||
dyn_owner.get_requests().push_back(req);
|
dyn_owner.get_requests().push_back(req);
|
||||||
|
|
||||||
notify_change();
|
reset();
|
||||||
|
|
||||||
return *req;
|
return *req;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -453,7 +443,7 @@ ConcreteHistory::edit_request(Request& request,
|
||||||
StaticRequest& core = req->get_core();
|
StaticRequest& core = req->get_core();
|
||||||
core.set_instant(instant);
|
core.set_instant(instant);
|
||||||
|
|
||||||
reset(true);
|
reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -462,8 +452,6 @@ ConcreteHistory::add_subrequest(Request& request,
|
||||||
resource_key_t resource_key,
|
resource_key_t resource_key,
|
||||||
time_t duration)
|
time_t duration)
|
||||||
{
|
{
|
||||||
reset(false);
|
|
||||||
|
|
||||||
DynamicRequest& dyn_request = down_cast<DynamicRequest&>(request);
|
DynamicRequest& dyn_request = down_cast<DynamicRequest&>(request);
|
||||||
|
|
||||||
StaticSubRequest* core = new StaticSubRequest(resource_key, duration);
|
StaticSubRequest* core = new StaticSubRequest(resource_key, duration);
|
||||||
|
@ -471,7 +459,8 @@ ConcreteHistory::add_subrequest(Request& request,
|
||||||
|
|
||||||
dyn_request.get_subrequests().push_back(subreq);
|
dyn_request.get_subrequests().push_back(subreq);
|
||||||
|
|
||||||
notify_change();
|
reset();
|
||||||
|
|
||||||
return *subreq;
|
return *subreq;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -485,14 +474,7 @@ ConcreteHistory::edit_subrequest(SubRequest& subrequest,
|
||||||
core.set_resource_key(resource_key);
|
core.set_resource_key(resource_key);
|
||||||
core.set_length(duration);
|
core.set_length(duration);
|
||||||
|
|
||||||
reset(true);
|
reset();
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
ConcreteHistory::reset()
|
|
||||||
{
|
|
||||||
reset(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -509,9 +491,15 @@ ConcreteHistory::set_front(position p)
|
||||||
notify_change();
|
notify_change();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ConcreteHistory::reset(bool notify)
|
ConcreteHistory::reset()
|
||||||
{
|
{
|
||||||
|
#ifndef NDEBUG
|
||||||
|
static unsigned int n = 0;
|
||||||
|
std::cerr << "ConcreteHistory::reset() called for the " << ++n << "-th time." << std::endl;
|
||||||
|
#endif
|
||||||
|
|
||||||
assert(_snapshots.size() > 0);
|
assert(_snapshots.size() > 0);
|
||||||
Snapshots::iterator it = _snapshots.begin();
|
Snapshots::iterator it = _snapshots.begin();
|
||||||
it++; // Skip first environment that we saved
|
it++; // Skip first environment that we saved
|
||||||
|
@ -521,8 +509,7 @@ ConcreteHistory::reset(bool notify)
|
||||||
_front = 0;
|
_front = 0;
|
||||||
_sealed = false;
|
_sealed = false;
|
||||||
|
|
||||||
if (notify)
|
notify_change();
|
||||||
notify_change();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -118,7 +118,6 @@ namespace sgpem
|
||||||
bool seal();
|
bool seal();
|
||||||
|
|
||||||
void reset(); // Implements a virtual method
|
void reset(); // Implements a virtual method
|
||||||
void reset(bool notify); // Only available in this class
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
typedef std::vector<ConcreteEnvironment*> Snapshots;
|
typedef std::vector<ConcreteEnvironment*> Snapshots;
|
||||||
|
|
|
@ -124,7 +124,7 @@ CPUPoliciesGatekeeper::activate_policy(History *history, CPUPolicy* policy) thro
|
||||||
policy->activate();
|
policy->activate();
|
||||||
_active_policies[history] = policy;
|
_active_policies[history] = policy;
|
||||||
// the content of history (if any) is not vaild any more.
|
// the content of history (if any) is not vaild any more.
|
||||||
down_cast<ConcreteHistory*>(history)->reset(true);
|
down_cast<ConcreteHistory*>(history)->reset();
|
||||||
}
|
}
|
||||||
catch(const CPUPolicyException& e)
|
catch(const CPUPolicyException& e)
|
||||||
{
|
{
|
||||||
|
|
|
@ -98,7 +98,7 @@ ResourcePoliciesGatekeeper::activate_policy(History *history, ResourcePolicy* po
|
||||||
|
|
||||||
_active_policies[history] = policy;
|
_active_policies[history] = policy;
|
||||||
// the content of history (if any) is not vaild any more.
|
// the content of history (if any) is not vaild any more.
|
||||||
down_cast<ConcreteHistory*>(history)->reset(true);
|
down_cast<ConcreteHistory*>(history)->reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
ResourcePoliciesGatekeeper::ResourcePoliciesGatekeeper()
|
ResourcePoliciesGatekeeper::ResourcePoliciesGatekeeper()
|
||||||
|
|
|
@ -19,13 +19,14 @@
|
||||||
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
// DISCLAIMER FOR THE RAMPANT CODER: \\
|
// DISCLAIMER FOR THE RAMPANT CODER: \\
|
||||||
// ----------------------------------------------------\\
|
// ----------------------------------------------------\\
|
||||||
// ``If you touch this code, your ass is grass, \\
|
// ``If you touch this code, your ass is grass, \\
|
||||||
// and I'm the lawnmover.'' \\
|
// and I'm the lawnmover.'' \\
|
||||||
// -- David Cutler \\
|
// -- David Cutler \\
|
||||||
// ----------------------------------------------------\\
|
// ----------------------------------------------------\\
|
||||||
|
*/
|
||||||
|
|
||||||
#include "concrete_environment.hh"
|
#include "concrete_environment.hh"
|
||||||
#include "concrete_history.hh"
|
#include "concrete_history.hh"
|
||||||
|
|
Loading…
Reference in New Issue