The Sparta Modeling Framework
Loading...
Searching...
No Matches
AsyncEvent.hpp
1// <AsyncEvent.hpp> -*- C++ -*-
2
3#pragma once
4
6
7namespace sparta
8{
21 template<SchedulingPhase sched_phase_T = SchedulingPhase::Tick>
22 class AsyncEvent : public Event<sched_phase_T>
23 {
24 public:
25 AsyncEvent(TreeNode *event_set,
26 const std::string &name,
27 const SpartaHandler &consumer_event_handler,
28 Clock::Cycle delay = 0)
29 : Event<sched_phase_T>(event_set, name, consumer_event_handler, delay) { }
30
37 Scheduler *scheduler) override
38 {
39 sparta_assert(scheduler != nullptr);
40 scheduler->scheduleAsyncEvent(this, rel_tick);
41 }
42
52 };
53} /* namespace sparta */
File that defines the Event class.
#define sparta_assert(...)
Simple variadic assertion that will throw a sparta_exception if the condition fails.
In a multi-threaded sim environment, this event is used to schedule an event asynchronously.
void cancel()
Cancel this event. This method should only be called from the main scheduler thread.
virtual void scheduleRelativeTick(Scheduler::Tick rel_tick, Scheduler *scheduler) override
Asynchronously schedule this event on an relative tick.
Event is a simple class for scheduling random events on the Scheduler.
Definition Event.hpp:42
PrecedenceSetup scheduler_
Cache a pointer to the scheduler used.
A class that lets you schedule events now and in the future.
void scheduleAsyncEvent(Scheduleable *sched, Scheduler::Tick delay)
Asynchronously schedule an event.
uint64_t Tick
Typedef for our unit of time.
void cancelAsyncEvent(Scheduleable *scheduleable)
Cancel the given Scheduleable.
Node in a composite tree representing a sparta Tree item.
Definition TreeNode.hpp:205
Macros for handling exponential backoff.