- Completed policy-related error handling code

git-svn-id: svn://svn.gna.org/svn/sgpemv2/trunk@839 3ecf2c5c-341e-0410-92b4-d18e462d057c
This commit is contained in:
elvez 2006-08-10 22:59:00 +00:00
parent 48fc2f5a00
commit 17ca8156d9
7 changed files with 30 additions and 14 deletions

View file

@ -91,7 +91,7 @@ CPUPoliciesGatekeeper::get_current_policy(History* history) throw(runtime_error)
void
CPUPoliciesGatekeeper::activate_policy(History *history, CPUPolicy* policy)
{
assert(history != NULL && policy != NULL);
assert(history != NULL);
ActiveIterator end = _active_policies.end();
ActiveIterator pos = _active_policies.find(history);
@ -99,6 +99,12 @@ CPUPoliciesGatekeeper::activate_policy(History *history, CPUPolicy* policy)
if (pos != end && pos->second != policy)
_active_policies[history]->deactivate();
if(policy == NULL)
{
_active_policies.erase(pos);
return;
}
if (pos == end || pos->second != policy)
{
try
@ -106,7 +112,7 @@ CPUPoliciesGatekeeper::activate_policy(History *history, CPUPolicy* policy)
policy->activate();
_active_policies[history] = policy;
}
catch(UserInterruptException e)
catch(const CPUPolicyException& e)
{
//FIXME what to do here???
//probably throwing again a MalformedPolicyException