60 #ifndef SRC_VAULT_GEAR_SCHEDULER_INVOCATION_H_ 61 #define SRC_VAULT_GEAR_SCHEDULER_INVOCATION_H_ 71 #include <boost/lockfree/queue.hpp> 72 #include <unordered_set> 84 const size_t INITIAL_CAPACITY = 128;
97 uint32_t manifestation :32;
105 , isCompulsory{
false}
111 ,
bool compulsory =
false)
115 , manifestation{manID}
116 , isCompulsory{compulsory}
127 return starting > o.starting;
130 operator bool()
const {
return bool{activity}; }
131 operator Activity*()
const {
return activity; }
160 using InstructQueue = boost::lockfree::queue<ActivationEvent>;
161 using PriorityQueue = std::priority_queue<ActivationEvent>;
162 using ActivationSet = std::unordered_set<ManifestationID>;
164 InstructQueue instruct_;
165 PriorityQueue priority_;
167 ActivationSet allowed_;
171 : instruct_{INITIAL_CAPACITY}
181 instruct_.consume_all([](
auto&){});
182 priority_ = PriorityQueue();
192 bool success = instruct_.push (move (actEvent));
194 throw error::Fatal{
"Scheduler entrance: memory allocation failed"};
206 while (instruct_.pop (actEvent))
207 priority_.push (move (actEvent));
219 priority_.push (move (actEvent));
261 allowed_.insert (manID);
267 allowed_.erase (manID);
277 return not priority_.empty()
278 and priority_.top().starting <= waterLevel(now);
286 return not priority_.empty()
287 and waterLevel(now) > priority_.top().deadline;
295 or util::contains (allowed_, manID);
302 return isMissed (now)
303 or (not priority_.empty()
304 and not isActivated (priority_.top().manifestation));
311 return isMissed (now)
312 and (not priority_.empty()
313 and priority_.top().isCompulsory
314 and isActivated (priority_.top().manifestation));
318 hasPendingInput()
const 320 return not instruct_.empty();
326 return instruct_.empty()
327 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 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.