51 #ifndef SRC_VAULT_GEAR_SCHEDULER_INVOCATION_H_ 52 #define SRC_VAULT_GEAR_SCHEDULER_INVOCATION_H_ 62 #include <boost/lockfree/queue.hpp> 63 #include <unordered_set> 75 const size_t INITIAL_CAPACITY = 128;
88 uint32_t manifestation :32;
102 ,
bool compulsory =
false)
106 , manifestation{manID}
107 , isCompulsory{compulsory}
118 return starting > o.starting;
121 operator bool()
const {
return bool{activity}; }
122 operator Activity*()
const {
return activity; }
151 using InstructQueue = boost::lockfree::queue<ActivationEvent>;
152 using PriorityQueue = std::priority_queue<ActivationEvent>;
153 using ActivationSet = std::unordered_set<ManifestationID>;
155 InstructQueue instruct_;
156 PriorityQueue priority_;
158 ActivationSet allowed_;
162 : instruct_{INITIAL_CAPACITY}
172 instruct_.consume_all([](
auto&){});
173 priority_ = PriorityQueue();
183 bool success = instruct_.push (move (actEvent));
185 throw error::Fatal{
"Scheduler entrance: memory allocation failed"};
197 while (instruct_.pop (actEvent))
198 priority_.push (move (actEvent));
210 priority_.push (move (actEvent));
252 allowed_.insert (manID);
258 allowed_.erase (manID);
268 return not priority_.empty()
269 and priority_.top().starting <= waterLevel(now);
277 return not priority_.empty()
278 and waterLevel(now) > priority_.top().deadline;
286 or util::contains (allowed_, manID);
293 return isMissed (now)
294 or (not priority_.empty()
295 and not isActivated (priority_.top().manifestation));
302 return isMissed (now)
303 and (not priority_.empty()
304 and priority_.top().isCompulsory
305 and isActivated (priority_.top().manifestation));
309 hasPendingInput()
const 311 return not instruct_.empty();
317 return instruct_.empty()
318 and priority_.empty();
static const Time ANYTIME
border condition marker value. ANYTIME <= any time value
Record to describe an Activity, to happen within the Scheduler's control flow.
void discardSchedule()
forcibly clear out the schedule
void feedPrioritisation(ActivationEvent actEvent)
Feed the given Activity directly into time prioritisation, effectively bypassing the thread dispatchi...
Any copy and copy construction prohibited.
Time constrainedDeath(Time death)
bool isActivated(ManifestationID manID) const
determine if Activities with the given ManifestationID shall be processed
Lumiera's internal time value datatype.
void instruct(ActivationEvent actEvent)
Accept an ActivationEvent with an Activity for time-bound execution.
void activate(ManifestationID manID)
Enable entries marked with a specific ManifestationID to be processed.
Derived specific exceptions within Lumiera's exception hierarchy.
Mix-Ins to allow or prohibit various degrees of copying and cloning.
bool isOutdated(Time now) const
determine if Activity at scheduler is outdated and should be discarded
Marker for current (and obsolete) manifestations of a CalcStream processed by the Render-Engine...
Tiny helper functions and shortcuts to be used everywhere Consider this header to be effectively incl...
ActivationEvent peekHead()
bool isMissed(Time now) const
determine if the Activity at scheduler head missed it's deadline.
Basic set of definitions and includes commonly used together (Vault).
static const Time NEVER
border condition marker value. NEVER >= any time value
bool isOutOfTime(Time now) const
detect a compulsory Activity at scheduler head with missed deadline
ActivationEvent pullHead()
Retrieve from the scheduling queue the entry with earliest start time.
a family of time value like entities and their relationships.
void feedPrioritisation()
Pick up all new events from the entrance queue and enqueue them to be retrieved ordered by start time...
basic constant internal time value.
Time constrainedStart(Time start)
Vault-Layer implementation namespace root.
bool isDue(Time now) const
Determine if there is work to do right now.
Scheduler Layer-1 : time based dispatch.
Descriptor for a piece of operational logic performed by the scheduler.