Commit e1750c09 authored by Mirko Stoffers's avatar Mirko Stoffers

Fixed bug with not-removed events

Problem: With Horizon the semantics of cScheduler::getNextEvent() and
cSimulator::doOneEvent() where changed. Without Horiozn, getNextEvent()
peeked the event in the FES, and doOneEvent() removed it. This was
changed for Horizon, but the cParsimScheduler::getNextEvent() function
was missed.

Solution: Reverted the semantics back to the stock OMNeT++ semantics.
This introduces a problem with the cEEFScheduler since the EEF scheduler
needs to pick a bunch of events from the FES and select one. This was
fixed by putting the selected event back into the heap in
cEEFScheduler::getNextEvent(). I prefered this solution since the
changed semantics would also break the TkEnv.
parent fc839da5
......@@ -61,7 +61,7 @@ cMessage *cSequentialScheduler::getNextEvent()
//
// If we retrieve a valid msg from the queue, we return it:
//
cMessage *msg = sim->msgQueue.removeFirst();
cMessage *msg = sim->msgQueue.peekFirst();
if (msg)
return msg;
......@@ -81,7 +81,7 @@ cMessage *cSequentialScheduler::getNextEvent()
{
__asm__ ("pause");
}
msg = sim->msgQueue.removeFirst();
msg = sim->msgQueue.peekFirst();
//
// If there is a msg now, we return it:
......@@ -102,7 +102,7 @@ cMessage *cSequentialScheduler::getNextEvent()
while (!msg)
{
msg = sim->msgQueue.removeFirst();
msg = sim->msgQueue.peekFirst();
if (!msg)
throw cTerminationException(eENDEDOK);
......@@ -166,7 +166,9 @@ cMessage *cEEFScheduler::getNextEvent()
}
updateIES();
return getFirstEvent();
cMessage* msg=getFirstEvent();
sim->msgQueue.insert(msg);
return msg;
}
void cEEFScheduler::updateIES() {
......@@ -383,7 +385,7 @@ cMessage *cRealTimeScheduler::getNextEvent()
//TODO: Handle barriermsg
throw cRuntimeError("RealTimeScheduler is not supported with Threadpool.");
}
cMessage *msg = sim->msgQueue.removeFirst();
cMessage *msg = sim->msgQueue.peekFirst();
if (!msg)
throw cTerminationException(eENDEDOK);
......
......@@ -686,6 +686,10 @@ void cSimulation::doOneEvent(cMessage* msg)
}
bool mayPar = mod->mayParallelize(msg, duration);
cMessage *msg2=msgQueue.removeFirst();
assert(msg==msg2);
// execute this event in parallel
if (mayPar && threaded && !sequentialExecution)
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment