9struct async_event : sc_core::sc_prim_channel {
11 async_event() =
default;
13 async_event(
char const* nm)
14 : sc_core::sc_prim_channel{nm} {}
17 if(std::this_thread::get_id() ==
id)
18 ev_.notify(sc_core::SC_ZERO_TIME);
20 pending_update.store(
true, std::memory_order_release);
21 async_request_update();
25 void update()
override {
26 if(pending_update.exchange(
false, std::memory_order_acq_rel)) {
27 ev_.notify(sc_core::SC_ZERO_TIME);
30 const sc_core::sc_event& operator()()
const {
return ev_; }
31 const sc_core::sc_event& event()
const {
return ev_; }
34 const std::thread::id
id{std::this_thread::get_id()};
35 sc_core::sc_event ev_;
36 std::atomic<bool> pending_update{
false};