Project

General

Profile

Statistics
| Branch: | Revision:

root / src / sim / parsim / cnosynchronization.cc @ 81ad8b66

History | View | Annotate | Download (1.68 KB)

1 01873262 Georg Kunz
//=========================================================================
2
//  CNOSYNCHRONIZATION.CC - part of
3
//
4
//                  OMNeT++/OMNEST
5
//           Discrete System Simulation in C++
6
//
7
//  Author: Andras Varga, 2003
8
//          Dept. of Electrical and Computer Systems Engineering,
9
//          Monash University, Melbourne, Australia
10
//
11
//=========================================================================
12
13
/*--------------------------------------------------------------*
14
  Copyright (C) 2003-2008 Andras Varga
15
  Copyright (C) 2006-2008 OpenSim Ltd.
16

17
  This file is distributed WITHOUT ANY WARRANTY. See the file
18
  `license' for details on this and other legal matters.
19
*--------------------------------------------------------------*/
20
21
22
#include "cmessage.h"
23
#include "cmodule.h"
24
#include "cgate.h"
25
#include "cenvir.h"
26
#include "cnosynchronization.h"
27
#include "cparsimpartition.h"
28
#include "cparsimcomm.h"
29
#include "ccommbuffer.h"
30
#include "messagetags.h"
31
#include "globals.h"
32
#include "regmacros.h"
33
34
USING_NAMESPACE
35
36
Register_Class(cNoSynchronization);
37
38
39
cNoSynchronization::cNoSynchronization() : cParsimProtocolBase()
40
{
41
}
42
43
cNoSynchronization::~cNoSynchronization()
44
{
45
}
46
47
void cNoSynchronization::startRun()
48
{
49
}
50
51
void cNoSynchronization::endRun()
52
{
53
}
54
55
56
cMessage *cNoSynchronization::getNextEvent()
57
{
58
    // if no more local events, wait for something to come from other partitions
59
    if (sim->msgQueue.isEmpty())
60
    {
61
        ev.printf("no local events, waiting for something to arrive from other partitions\n");
62
        if (!receiveBlocking())
63
            return NULL;
64
    }
65
    else
66
    {
67
        receiveNonblocking();
68
    }
69
    cMessage *msg = sim->msgQueue.peekFirst();
70
    return msg;
71
}
72