Revision fbe00e73 src/sim/cmessage.cc

View differences:

src/sim/cmessage.cc
27 27
#include "cmessage.h"
28 28
#include "cexception.h"
29 29
#include "cenvir.h"
30
#include "casyncmodule.h"
31 30

  
32 31
#ifdef WITH_PARSIM
33 32
#include "ccommbuffer.h"
......
375 374
simtime_t cMessage::getEventDuration() {
376 375
    if (duration == SimTime::simTimeUninitialized) {
377 376
        cSimpleModule* mod = (cSimpleModule*) simulation.getModule(getArrivalModuleId());
378
        if (mod && mod->isAsyncModule()) {
377
        if (mod) {
379 378
            // block if another thread is busy inside this module
380 379
            // then set the module to busy
381 380
            // this must only be unset after the corresponding event has been processed,
382 381
            // since otherwise the return value of getProcessingDelay is not deterministically determined
383 382
            // (in the mean time there may have been other events, changing the outcome of getProcessingDelay)
384
            ((cAsyncModule*) mod)->waitIfBusy();
385
            ((cAsyncModule*) mod)->setBusy();
386
            duration = ((cAsyncModule*) mod)->getProcessingDelay(this);
383
            mod->waitIfBusy();
384
            mod->setBusy();
385
            duration = mod->getProcessingDelay(this);
387 386
        }
388 387
    }
389 388
    return duration;

Also available in: Unified diff