bool(*handle_event)(EventPositionBase*self,EventNode*event);// If returns false, the scheduler should not rewind back to the start. Must return true if any events were deleted
boolwaiting_new_event;// Skip from handling until it is set to true. Assigning this position to a event should unset this flag
};
structevent_node{
EventNode*prev,*next;
EventPositionBase*position;
size_tinput_index;
EventDatadata;
};
externEventNodeEND_EVENTS;
#define FIRST_EVENT (END_EVENTS.next)
#define LAST_EVENT (END_EVENTS.prev)
#define FOREACH_EVENT(ev) for (EventNode *ev = FIRST_EVENT; ev && (ev != &END_EVENTS); ev = ev->next)
#define FOREACH_EVENT_DESC(ev) for (EventNode *ev = LAST_EVENT; ev && (ev != &END_EVENTS); ev = ev->prev)
// Creates count replicas after the source event in the list, position is NULL, returns the number of successfully created replicas