21class async_event :
public sc_core::sc_prim_channel,
public sc_core::sc_event
24 sc_core::sc_time m_delay;
27 bool outstanding =
false;
28 enum { none, attach, detach } attach_pending_state = none;
31 async_event(
bool start_attached =
true): outstanding(0)
33 tid = std::this_thread::get_id();
34 enable_attach_suspending(start_attached);
37 void async_notify() { notify(); }
41 if (tid == std::this_thread::get_id()) {
42 sc_core::sc_event::notify();
44 notify(sc_core::SC_ZERO_TIME);
47 void notify(
double d, sc_core::sc_time_unit u) { notify(sc_core::sc_time(d, u)); }
48 void notify(sc_core::sc_time delay)
50 if (tid == std::this_thread::get_id()) {
51 sc_core::sc_event::notify(delay);
57 async_request_update();
58#ifndef SC_HAS_SUSPENDING
59 sc_core::sc_internal_async_wakeup();
64 void async_attach_suspending()
66#ifndef SC_HAS_ASYNC_ATTACH_SUSPENDING
67 sc_core::async_attach_suspending(
this);
69 if (tid == std::this_thread::get_id()) {
70 this->sc_core::sc_prim_channel::async_attach_suspending();
73 attach_pending_state = attach;
75 async_request_update();
80 void async_detach_suspending()
82#ifndef SC_HAS_ASYNC_ATTACH_SUSPENDING
83 sc_core::async_detach_suspending(
this);
85 if (tid == std::this_thread::get_id()) {
86 this->sc_core::sc_prim_channel::async_detach_suspending();
89 attach_pending_state = detach;
91 async_request_update();
96 void enable_attach_suspending(
bool e) { e ? this->async_attach_suspending() : this->async_detach_suspending(); }
104 sc_event::notify(m_delay);
107 switch (attach_pending_state) {
109 this->async_attach_suspending();
112 this->async_detach_suspending();
117 attach_pending_state = none;
120 void start_of_simulation()