This simplistic example illustrates the use of sequential processes, as defined by the Tprocess class.
#include <iostream>
public:
private:
};
public:
};
public:
int x;
E(int n): x(n) {};
};
std::cout << "Producer started" << std::endl;
for(int i = 0; i < 10; ++i) {
std::cout << "Producer waiting for an event" << std::endl;
wait_for_event();
std::cout << "Producer signaling value " << i << std::endl;
}
}
std::cout << "Consumer started" << std::endl;
for(;;) {
std::cout << "Consumer waiting for an event" << std::endl;
const E * x = (const E *)wait_for_event();
<< x->x << std::endl;
}
}
int main(int argc, char * argv[]) {
std::cout << "Program started" << std::endl;
std::cout << "Simulation started" << std::endl;
std::cout << "Simulation ended" << std::endl;
}