20#ifndef REALM_EVENT_IMPL_H
21#define REALM_EVENT_IMPL_H
53 virtual void print(std::ostream &os)
const = 0;
102 long long max_ns) = 0;
135 std::optional<size_t> expected_events = std::optional<size_t>());
152 virtual void print(std::ostream &os)
const;
226 gen_t previous_subscribe_gen);
254 int new_poisoned_count,
TimeLimit work_until);
347#include "realm/event_impl.inl"
Definition event_impl.h:182
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)
Definition event_impl.h:85
virtual bool remove_waiter(gen_t needed_gen, EventWaiter *waiter)=0
NodeID owner
Definition event_impl.h:122
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:87
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:121
static bool add_waiter(Event needed, EventWaiter *waiter)
ID me
Definition event_impl.h:120
virtual bool add_waiter(gen_t needed_gen, EventWaiter *waiter)=0
Definition event_impl.h:141
virtual void event_triggered(bool poisoned, TimeLimit work_until)
EventMerger * merger
Definition event_impl.h:149
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
Definition event_impl.h:127
std::deque< MergeEventPrecondition > overflow_preconditions
Definition event_impl.h:178
static constexpr size_t MAX_INLINE_PRECONDITIONS
Definition event_impl.h:175
GenEventImpl * event_impl
Definition event_impl.h:167
bool ignore_faults
Definition event_impl.h:170
atomic< int > faults_observed
Definition event_impl.h:173
MergeEventPrecondition * get_next_precondition(void)
EventImpl::gen_t finish_gen
Definition event_impl.h:168
bool recycle_preconditions
Definition event_impl.h:171
void add_precondition(Event wait_for)
void prepare_merger(Event _finish_event, bool _ignore_faults, std::optional< size_t > expected_events=std::optional< size_t >())
unsigned precondition_offset
Definition event_impl.h:169
EventMerger(GenEventImpl *_event_impl)
EventWaiter::EventWaiterList free_preconditions
Definition event_impl.h:179
atomic< int > count_needed
Definition event_impl.h:172
MergeEventPrecondition inline_preconditions[MAX_INLINE_PRECONDITIONS]
Definition event_impl.h:176
void precondition_triggered(bool poisoned, TimeLimit work_until, MergeEventPrecondition *precondition=nullptr)
bool is_active(void) const
Definition event_impl.h:66
Mutex mutex
Definition event_impl.h:76
virtual bool do_work(TimeLimit work_until)
static thread_local EventWaiter::EventWaiterList * nested_poisoned
Definition event_impl.h:81
static thread_local EventWaiter::EventWaiterList * nested_normal
Definition event_impl.h:80
EventWaiter::EventWaiterList delayed_poisoned
Definition event_impl.h:78
void trigger_event_waiters(EventWaiter::EventWaiterList &to_trigger, bool poisoned, TimeLimit trigger_until)
EventWaiter::EventWaiterList delayed_normal
Definition event_impl.h:77
Definition event_impl.h:49
virtual ~EventWaiter(void)
Definition event_impl.h:51
REALM_PMTA_DEFN(EventWaiter, IntrusiveListLink< EventWaiter >, ew_list_link)
IntrusiveListLink< EventWaiter > ew_list_link
Definition event_impl.h:56
virtual Event get_finish_event(void) const =0
IntrusiveList< EventWaiter, REALM_PMTA_USE(EventWaiter, ew_list_link), DummyLock > EventWaiterList
Definition event_impl.h:60
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:198
Operation * current_trigger_op
Definition event_impl.h:303
bool is_generation_poisoned(gen_t gen) const
std::map< gen_t, bool > local_triggers
Definition event_impl.h:338
static void trigger(Event e, bool poisoned, TimeLimit work_until)
atomic< gen_t > gen_subscribed
Definition event_impl.h:284
static Event merge_events(span< const Event > wait_for, bool ignore_faults)
virtual bool add_waiter(gen_t needed_gen, EventWaiter *waiter)
void init(ID _me, unsigned _init_owner)
gen_t * poisoned_generations
Definition event_impl.h:332
NodeSet remote_waiters
Definition event_impl.h:321
static Event ignorefaults(Event wait_for)
static const ID::ID_Types ID_TYPE
Definition event_impl.h:200
KernelMutex external_waiter_mutex
Definition event_impl.h:315
std::unique_ptr< EventCommunicator > event_comm
Definition event_impl.h:297
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)
KernelMutex::CondVar external_waiter_condvar
Definition event_impl.h:316
bool free_list_insertion_delayed
Definition event_impl.h:342
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)
EventTriggerNotifier * event_triggerer
Definition event_impl.h:296
EventWaiter::EventWaiterList current_local_waiters
Definition event_impl.h:309
bool has_external_waiters
Definition event_impl.h:313
Event current_event(void) const
static GenEventImpl * create_genevent(void)
EventMerger merger
Definition event_impl.h:294
virtual bool has_triggered(gen_t needed_gen, bool &poisoned)
atomic< int > num_poisoned_generations
Definition event_impl.h:285
static const int POISONED_GENERATION_LIMIT
Definition event_impl.h:325
bool has_local_triggers
Definition event_impl.h:286
static ID make_id(const GenEventImpl &dummy, int owner, ID::IDType index)
Definition event_impl.h:213
std::map< gen_t, EventWaiter::EventWaiterList > future_local_waiters
Definition event_impl.h:310
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:300
virtual void external_wait(gen_t needed_gen, bool &poisoned)
void set_trigger_op(gen_t gen, Operation *op)
GenEventImpl * next_free
Definition event_impl.h:291
atomic< gen_t > generation
Definition event_impl.h:283
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
Definition operation.h:32
Definition proc_impl.h:51
Definition runtime_impl.h:264
#define REALM_PMTA_USE(structtype, name)
Definition lists.h:42
Definition activemsg.h:38
int NodeID
Definition nodeset.h:40
Definition event_impl.h:263
GenEventImplAllocator(EventTriggerNotifier *t)
Definition event_impl.h:268
void construct(GenEventImpl *storage, ID id, unsigned owner) const
Definition event_impl.h:272
GenEventImplAllocator(void)=default
EventTriggerNotifier * triggerer
Definition event_impl.h:264