Commit cbd2c699 authored by Mirko Stoffers's avatar Mirko Stoffers

Renamed duration -> eventDuration

Problem: We had a variable cMessage::duration for Horizon and a
variable cPacket::duration from OMNeT++ itself while cPacket inherits
from cMessage. This might lead to the wrong variable being accessed
by packets.

Solution: Renamed the Horizon variable cMessage::duration in
cMessage::eventDuration
parent fbe00e73
...@@ -164,7 +164,7 @@ protected: ...@@ -164,7 +164,7 @@ protected:
// //
// Horizon // Horizon
// //
simtime_t duration; // (minimum) duration of the asynchronous event simtime_t eventDuration; // (minimum) eventDuration of the asynchronous event
int taskindex; // used by cTaskHeap (-1 if not on heap) int taskindex; // used by cTaskHeap (-1 if not on heap)
unsigned long taskinsertordr; // used by cTaskHeap unsigned long taskinsertordr; // used by cTaskHeap
...@@ -210,19 +210,19 @@ protected: ...@@ -210,19 +210,19 @@ protected:
//@{ //@{
/** /**
* Returns the duration of this event. * Returns the eventDuration of this event.
*/ */
simtime_t getEventDuration(); simtime_t getEventDuration();
/** /**
* Sets the duration of this event. * Sets the eventDuration of this event.
*/ */
inline void setEventDuration(simtime_t t) {duration = t;} inline void setEventDuration(simtime_t t) {eventDuration = t;}
/** /**
* Returns the end of the duration interval. * Returns the end of the eventDuration interval.
*/ */
inline simtime_t getTend() const {return delivd + duration;} inline simtime_t getTend() const {return delivd + eventDuration;}
//@} //@}
/** @name Internal Horizon use only. */ /** @name Internal Horizon use only. */
......
...@@ -83,7 +83,7 @@ cMessage::cMessage(const char *name, short k) : cOwnedObject(name, false) ...@@ -83,7 +83,7 @@ cMessage::cMessage(const char *name, short k) : cOwnedObject(name, false)
heapindex = -1; heapindex = -1;
prev_event_num = -1; prev_event_num = -1;
duration = SimTime::simTimeUninitialized; eventDuration = SimTime::simTimeUninitialized;
msgtreeid = msgid = AO_fetch_and_add1(&next_id); msgtreeid = msgid = AO_fetch_and_add1(&next_id);
AO_fetch_and_add1(&total_msgs); AO_fetch_and_add1(&total_msgs);
AO_fetch_and_add1(&live_msgs); AO_fetch_and_add1(&live_msgs);
...@@ -372,7 +372,7 @@ void cMessage::setArrivalTime(simtime_t t) ...@@ -372,7 +372,7 @@ void cMessage::setArrivalTime(simtime_t t)
} }
simtime_t cMessage::getEventDuration() { simtime_t cMessage::getEventDuration() {
if (duration == SimTime::simTimeUninitialized) { if (eventDuration == SimTime::simTimeUninitialized) {
cSimpleModule* mod = (cSimpleModule*) simulation.getModule(getArrivalModuleId()); cSimpleModule* mod = (cSimpleModule*) simulation.getModule(getArrivalModuleId());
if (mod) { if (mod) {
// block if another thread is busy inside this module // block if another thread is busy inside this module
...@@ -382,10 +382,10 @@ simtime_t cMessage::getEventDuration() { ...@@ -382,10 +382,10 @@ simtime_t cMessage::getEventDuration() {
// (in the mean time there may have been other events, changing the outcome of getProcessingDelay) // (in the mean time there may have been other events, changing the outcome of getProcessingDelay)
mod->waitIfBusy(); mod->waitIfBusy();
mod->setBusy(); mod->setBusy();
duration = mod->getProcessingDelay(this); eventDuration = mod->getProcessingDelay(this);
} }
} }
return duration; return eventDuration;
} }
//---- //----
...@@ -401,7 +401,7 @@ cPacket::cPacket(const char *name, short k, int64 l) : cMessage(name, k) ...@@ -401,7 +401,7 @@ cPacket::cPacket(const char *name, short k, int64 l) : cMessage(name, k)
{ {
len = l; len = l;
encapmsg = NULL; encapmsg = NULL;
duration = 0; eventDuration = 0;
sharecount = 0; sharecount = 0;
} }
......
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