- Merge branch 0.3-r1003--scheduler-manage-preemption into trunk

git-svn-id: svn://svn.gna.org/svn/sgpemv2/trunk@1023 3ecf2c5c-341e-0410-92b4-d18e462d057c
This commit is contained in:
tchernobog 2006-09-06 12:29:22 +00:00
parent cb5d958790
commit df4b1b4205
11 changed files with 158 additions and 55 deletions

View file

@ -82,7 +82,7 @@ static T* deep_find(const std::vector<T*>& v, const T& obj)
// -----------------
ConcreteHistory::ConcreteHistory()
: History(), _snapshots()
: History(), _snapshots(), _sealed(false)
{
_snapshots.push_back(new ConcreteEnvironment());
}
@ -95,7 +95,7 @@ ConcreteHistory::~ConcreteHistory()
}
ConcreteHistory::ConcreteHistory(const ConcreteHistory& h) :
History(h)
History(h), _sealed(h._sealed)
{
typedef Snapshots::const_iterator SnapIt;
for (SnapIt it = h._snapshots.begin(); it != h._snapshots.end(); ++it)
@ -489,12 +489,16 @@ ConcreteHistory::edit_subrequest(SubRequest& subrequest,
void
ConcreteHistory::step_front(position p)
ConcreteHistory::set_front(position p)
{
_front = p;
if (p > _snapshots.size())
_front = _snapshots.size();
notify_change();
position old_front = _front;
if (p > _snapshots.size() - 1)
_front = _snapshots.size() - 1;
else
_front = p;
if(old_front != _front)
notify_change();
}
void
@ -507,6 +511,7 @@ ConcreteHistory::reset(bool notify)
for_each(it, _snapshots.end(), deletor<ConcreteEnvironment>());
_snapshots.resize(1); // Truncate to keep only our "model"
_front = 0;
_sealed = false;
if (notify)
notify_change();
@ -519,3 +524,18 @@ ConcreteHistory::notify_change()
for (it = _observers.begin(); it != _observers.end(); it++)
(*it)->update(*this);
}
bool
ConcreteHistory::is_sealed() const
{
return _sealed;
}
bool
ConcreteHistory::seal()
{
bool t = _sealed;
_sealed = true;
return t;
}