20#ifndef REALM_EVENT_IMPL_H
21#define REALM_EVENT_IMPL_H
55 virtual void print(std::ostream &os)
const = 0;
104 long long max_ns) = 0;
143 std::optional<size_t> expected_events = std::optional<size_t>(),
161 virtual void print(std::ostream &os)
const;
248 gen_t previous_subscribe_gen);
276 int new_poisoned_count,
TimeLimit work_until);
430#include "realm/event_impl.inl"
BackgroundWorkItem(const std::string &_name)
Definition event_impl.h:204
virtual void trigger(Event event, NodeID owner, bool poisoned)
virtual void update(Event event, NodeID to_update, span< EventImpl::gen_t > poisoned_generations)
virtual void subscribe(Event event, NodeID owner, EventImpl::gen_t previous_subscribe_gen)
virtual ~EventCommunicator()=default
virtual void update(Event event, NodeSet to_update, span< EventImpl::gen_t > poisoned_generations)
virtual bool remove_waiter(gen_t needed_gen, EventWaiter *waiter)=0
NodeID owner
Definition event_impl.h:124
virtual bool has_triggered(gen_t needed_gen, bool &poisoned)=0
Event make_event(gen_t gen) const
virtual void external_wait(gen_t needed_gen, bool &poisoned)=0
virtual bool external_timedwait(gen_t needed_gen, bool &poisoned, long long max_ns)=0
unsigned gen_t
Definition event_impl.h:89
virtual void subscribe(gen_t subscribe_gen)=0
static bool detect_event_chain(Event search_from, Event target, int max_depth, bool print_chain)
ProcessorImpl * owning_processor
Definition event_impl.h:123
static bool add_waiter(Event needed, EventWaiter *waiter)
ID me
Definition event_impl.h:122
virtual bool add_waiter(gen_t needed_gen, EventWaiter *waiter)=0
Definition event_impl.h:150
virtual void event_triggered(bool poisoned, TimeLimit work_until)
EventMerger * merger
Definition event_impl.h:158
MergeEventPrecondition(const MergeEventPrecondition &)=delete
MergeEventPrecondition(MergeEventPrecondition &&)=delete
virtual ~MergeEventPrecondition(void)=default
virtual Event get_finish_event(void) const
MergeEventPrecondition(void)=default
virtual void print(std::ostream &os) const
static constexpr size_t MAX_INLINE_PRECONDITIONS
Definition event_impl.h:172
FaultPropagation
Definition event_impl.h:132
@ AFTER_PRECONDITIONS
Definition event_impl.h:134
@ EARLY
Definition event_impl.h:133
GenEventImpl * event_impl
Definition event_impl.h:180
bool ignore_faults
Definition event_impl.h:183
atomic< int > faults_observed
Definition event_impl.h:187
MergeEventPrecondition * get_next_precondition(void)
EventImpl::gen_t finish_gen
Definition event_impl.h:181
bool recycle_preconditions
Definition event_impl.h:185
void add_precondition(Event wait_for)
unsigned precondition_offset
Definition event_impl.h:182
std::unique_ptr< std::deque< MergeEventPrecondition > > overflow_preconditions
Definition event_impl.h:200
EventMerger(GenEventImpl *_event_impl)
EventWaiter::EventWaiterList free_preconditions
Definition event_impl.h:201
atomic< int > count_needed
Definition event_impl.h:186
MergeEventPrecondition inline_preconditions[MAX_INLINE_PRECONDITIONS]
Definition event_impl.h:189
void prepare_merger(Event _finish_event, bool _ignore_faults, std::optional< size_t > expected_events=std::optional< size_t >(), FaultPropagation _fault_propagation=FaultPropagation::EARLY)
FaultPropagation fault_propagation
Definition event_impl.h:184
void precondition_triggered(bool poisoned, TimeLimit work_until, MergeEventPrecondition *precondition=nullptr)
bool is_active(void) const
Definition event_impl.h:68
Mutex mutex
Definition event_impl.h:78
virtual bool do_work(TimeLimit work_until)
EventWaiter::EventWaiterList delayed_poisoned
Definition event_impl.h:80
void trigger_event_waiters(EventWaiter::EventWaiterList &to_trigger, bool poisoned, TimeLimit trigger_until)
static EventWaiter::EventWaiterList * nested_poisoned
Definition event_impl.h:83
EventWaiter::EventWaiterList delayed_normal
Definition event_impl.h:79
static EventWaiter::EventWaiterList * nested_normal
Definition event_impl.h:82
Definition event_impl.h:51
virtual ~EventWaiter(void)
Definition event_impl.h:53
REALM_PMTA_DEFN(EventWaiter, IntrusiveListLink< EventWaiter >, ew_list_link)
IntrusiveListLink< EventWaiter > ew_list_link
Definition event_impl.h:58
virtual Event get_finish_event(void) const =0
IntrusiveList< EventWaiter, REALM_PMTA_USE(EventWaiter, ew_list_link), DummyLock > EventWaiterList
Definition event_impl.h:62
virtual void event_triggered(bool poisoned, TimeLimit work_until)=0
virtual void print(std::ostream &os) const =0
static const Event NO_EVENT
The value should be usued to initialize an event handle. NO_EVENT is always in has triggered state .
Definition event.h:71
Definition event_impl.h:220
Operation * current_trigger_op
Definition event_impl.h:343
gen_t current_trigger_op_gen
Definition event_impl.h:344
bool is_generation_poisoned(gen_t gen) const
static void trigger(Event e, bool poisoned, TimeLimit work_until)
atomic< gen_t > gen_subscribed
Definition event_impl.h:318
std::unique_ptr< LaggingViewState > lagging_view
Definition event_impl.h:417
static Event merge_events(span< const Event > wait_for, bool ignore_faults)
virtual bool add_waiter(gen_t needed_gen, EventWaiter *waiter)
bool set_trigger_op(gen_t gen, Operation *op)
void init(ID _me, unsigned _init_owner)
gen_t * poisoned_generations
Definition event_impl.h:396
NodeSet remote_waiters
Definition event_impl.h:385
static Event ignorefaults(Event wait_for)
static const ID::ID_Types ID_TYPE
Definition event_impl.h:222
Operation * get_trigger_op(gen_t gen)
bool trigger(gen_t gen_triggered, int trigger_node, bool poisoned, TimeLimit work_until)
void handle_remote_subscription(NodeID sender, gen_t subscribe_gen, gen_t previous_subscribe_gen)
friend class EventMerger
Definition event_impl.h:426
bool free_list_insertion_delayed
Definition event_impl.h:356
virtual bool remove_waiter(gen_t needed_gen, EventWaiter *waiter)
GenEventImpl(EventTriggerNotifier *_event_triggerer, EventCommunicator *_event_comm)
static void trigger(Event e, bool poisoned)
static Event merge_events(Event ev1, Event ev2, Event ev3=Event::NO_EVENT, Event ev4=Event::NO_EVENT, Event ev5=Event::NO_EVENT, Event ev6=Event::NO_EVENT)
virtual void subscribe(gen_t subscribe_gen)
EventCommunicator * event_comm
Definition event_impl.h:335
EventTriggerNotifier * event_triggerer
Definition event_impl.h:329
EventWaiter::EventWaiterList current_local_waiters
Definition event_impl.h:361
bool has_external_waiters
Definition event_impl.h:353
Event current_event(void) const
static GenEventImpl * create_genevent(void)
EventMerger merger
Definition event_impl.h:327
virtual bool has_triggered(gen_t needed_gen, bool &poisoned)
LaggingViewState & get_lagging_view(void)
atomic< int > num_poisoned_generations
Definition event_impl.h:319
static const int POISONED_GENERATION_LIMIT
Definition event_impl.h:389
bool has_local_triggers
Definition event_impl.h:351
static ID make_id(const GenEventImpl &dummy, int owner, ID::IDType index)
Definition event_impl.h:235
virtual bool external_timedwait(gen_t needed_gen, bool &poisoned, long long max_ns)
void process_update(gen_t current_gen, const gen_t *new_poisoned_generations, int new_poisoned_count, TimeLimit work_until)
Mutex mutex
Definition event_impl.h:338
bool find_local_trigger(gen_t gen, bool &poisoned) const
virtual void external_wait(gen_t needed_gen, bool &poisoned)
GenEventImpl * next_free
Definition event_impl.h:324
atomic< gen_t > generation
Definition event_impl.h:317
std::unique_ptr< ExternalWaiterSync > external_waiter_sync
Definition event_impl.h:378
void release_lagging_view_if_empty(void)
ExternalWaiterSync & get_external_waiter_sync(void)
static GenEventImpl * create_genevent(RuntimeImpl *runtime_impl)
static ID make_event(unsigned creator_node, unsigned gen_event_idx, unsigned generation)
ID_Types
Definition id.h:250
@ ID_EVENT
Definition id.h:253
::realm_id_t IDType
Definition id.h:32
KernelCondVar CondVar
Definition mutex.h:278
Definition operation.h:32
Definition proc_impl.h:51
Definition runtime_impl.h:271
#define REALM_PMTA_USE(structtype, name)
Definition lists.h:42
Definition activemsg.h:42
UnfairMutex Mutex
Definition mutex.h:68
int NodeID
Definition nodeset.h:40
Definition event_impl.h:368
KernelMutex mutex
Definition event_impl.h:373
KernelMutex::CondVar condvar
Definition event_impl.h:374
ExternalWaiterSync(void)
Definition event_impl.h:369
void construct(GenEventImpl *storage, ID id, unsigned owner) const
Definition event_impl.h:306
EventCommunicator * communicator
Definition event_impl.h:294
GenEventImplAllocator(void)=default
GenEventImplAllocator(EventTriggerNotifier *t, EventCommunicator *c)
Definition event_impl.h:298
EventTriggerNotifier * triggerer
Definition event_impl.h:293
Definition event_impl.h:406
std::map< gen_t, bool > local_triggers
Definition event_impl.h:414
std::map< gen_t, EventWaiter::EventWaiterList > future_local_waiters
Definition event_impl.h:409