Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00014 #include <systemc>
00015 #include "during.h"
00016
00017 #include "utils/io-lock.h"
00018 #include "utils/atomic-variable.h"
00019
00020 using namespace std;
00021 using namespace sc_core;
00022
00023 SC_MODULE(A), sc_during
00024 {
00025 atomic_variable<bool> b;
00026
00027 void producer() {
00028 L_COUT << "A 1: " << sc_time_stamp() << endl;
00029 wait(10, SC_NS);
00030 b.write(true);
00031 }
00032
00033 void consumer() {
00034 L_COUT << "B 1: " << sc_time_stamp() << endl;
00035 during(1, SC_NS, bind_this(&A::poll));
00036 L_COUT << "B 2: polling done" << endl;
00037 L_COUT << "// TEST-IGNORE: " << sc_time_stamp() << endl;
00038 }
00039 SC_CTOR(A) : b(false) {
00040 SC_THREAD(producer);
00041 SC_THREAD(consumer);
00042 }
00043
00044 void poll() {
00045 while (!b.read())
00046 extra_time(1, SC_NS);
00047 };
00048 };
00049
00050 int sc_main(int argc, char *argv[])
00051 {
00052 (void)argc; (void)argv;
00053 A a("a");
00054 {
00055 measure_time t;
00056 sc_start();
00057 }
00058
00059 return 0;
00060 }