Internal threshold-ordered pending event queues
Pending_List<Traits> shall own a sequence of active event nodes and a separate pool of reusable inactive nodes. Each active event shall contain an owned threshold value and borrowed handler/expired-flag bindings. Traits::less_than shall define a stable strict weak order on admitted threshold values. Threshold copy construction, assignment, destruction and that comparison shall not throw; selected threshold operations shall satisfy their own validity and resource prerequisites.
Clients shall synchronize access and retain the noncopying owning-list conditions of 🔗 5. Empty owning-list construction and remaining-node destruction. Active node positions shall belong to one list and remain valid only until their event is erased or their owner destroyed. Handlers and flags shall remain alive while their event is active or a borrowed reference is accessed. Inactive pooled nodes may retain old pointer values without accessing those external objects; their old external bindings need not outlive the pool. The queue shall not require global PPL initialization beyond the selected threshold's own needs. Any enclosing watcher interface shall retain its additional thread/signal restrictions.
Queue ownership, threshold ordering and external notification-object lifetimes have distinct scopes, especially after cancellation recycles a node.
Internal source headers: Pending_List_defs.hh and Pending_Element_defs.hh. Names belong to Parma_Polyhedra_Library::Implementation::Watchdog. Members for element contracts apply to Pending_Element<Threshold>; queue contracts apply to Pending_List<Traits>.
template <typename Traits> class Pending_List; template <typename Threshold> class Pending_Element;
Compare independent ordered event models, separate owners, borrowed identities and pool lifetimes with nonthrowing threshold fixtures and no library initialization.
src/Pending_List_defs.hh; src/Pending_List_inlines.hh; src/Pending_List_templates.hh; src/Pending_Element_defs.hh; src/Pending_Element_inlines.hh; src/Threshold_Watcher_defs.hh; src/Threshold_Watcher_templates.hh; src/Watchdog.cc; tests/pendinglistspec1.cc; tests/pendinglist1.cc.
Pending_Element construction shall copy the supplied threshold and bind the supplied handler and flag by reference identity. It shall not invoke the handler, modify the flag or retain a reference to the caller's threshold object. The selected threshold shall satisfy 🔗 1. Threshold-ordered pending events and caller prerequisites.
The newly constructed element's inherited links shall require binding into a valid ring before traversal, unlinking or destruction, retaining 🔗 2. Embedded-node construction and link initialization. Queue insertion shall establish that binding before exposing the element. A directly constructed element shall be attached by its caller before destruction; completed linked-element destruction shall retain the nonthrowing threshold lifetime and embedded- node contract.
Attribute construction alone does not initialize the inherited embedded-node links.
Internal source headers: Pending_List_defs.hh and Pending_Element_defs.hh. Names belong to Parma_Polyhedra_Library::Implementation::Watchdog. Members for element contracts apply to Pending_Element<Threshold>; queue contracts apply to Pending_List<Traits>.
Pending_Element(const Threshold& deadline, const Handler& handler, bool& expired_flag);
Construct directly into an owning embedded list with a nondefault-constructible threshold; verify the independent threshold copy, borrowed identities, no notification and completed-node destruction.
src/Pending_List_defs.hh; src/Pending_List_inlines.hh; src/Pending_List_templates.hh; src/Pending_Element_defs.hh; src/Pending_Element_inlines.hh; src/Threshold_Watcher_defs.hh; src/Threshold_Watcher_templates.hh; src/Watchdog.cc; tests/pendinglistspec1.cc; tests/pendinglist1.cc.
assign shall replace the owned threshold value and borrowed handler/ flag bindings with the supplied attributes, preserving the element's existing link position. It shall not allocate an event node, invoke a handler or reset either flag. The supplied threshold may alias this element's current threshold; self-value assignment shall retain its meaning. Callers reassigning active elements shall preserve the pending list's ordering before using its ordinary operations. Pooled elements shall be rebound before exposure as new active events.
Pool reuse requires replacing every event attribute without changing the detached node ownership protocol.
Internal source headers: Pending_List_defs.hh and Pending_Element_defs.hh. Names belong to Parma_Polyhedra_Library::Implementation::Watchdog. Members for element contracts apply to Pending_Element<Threshold>; queue contracts apply to Pending_List<Traits>.
void assign(const Threshold& deadline, const Handler& handler, bool& expired_flag);
Check every old/new handler/flag pairing, self-borrowed deadline assignment, unchanged node links and no handler/flag side effects.
src/Pending_List_defs.hh; src/Pending_List_inlines.hh; src/Pending_List_templates.hh; src/Pending_Element_defs.hh; src/Pending_Element_inlines.hh; src/Threshold_Watcher_defs.hh; src/Threshold_Watcher_templates.hh; src/Watchdog.cc; tests/pendinglistspec1.cc; tests/pendinglist1.cc.
deadline() shall return a const reference to the owned threshold; handler() shall return a const reference to the bound handler; expired_flag() shall return a mutable reference to the bound Boolean even through a const element wrapper. Access shall preserve all attributes and links. A reference to the threshold shall require the node and threshold object to remain alive, and shall observe any later admitted reassignment. Handler/flag references shall retain the external object's lifetime independently of the element wrapper. Invoking or modifying a returned external object shall be a caller action, not an automatic queue notification.
Event access must preserve actual external identities and distinguish reference access from notification scheduling.
Internal source headers: Pending_List_defs.hh and Pending_Element_defs.hh. Names belong to Parma_Polyhedra_Library::Implementation::Watchdog. Members for element contracts apply to Pending_Element<Threshold>; queue contracts apply to Pending_List<Traits>.
const Threshold& deadline() const; const Handler& handler() const; bool& expired_flag() const;
Check exact types/addresses through const and mutable wrappers, independently copied thresholds, explicit caller notification and direct flag mutation.
src/Pending_List_defs.hh; src/Pending_List_inlines.hh; src/Pending_List_templates.hh; src/Pending_Element_defs.hh; src/Pending_Element_inlines.hh; src/Threshold_Watcher_defs.hh; src/Threshold_Watcher_templates.hh; src/Watchdog.cc; tests/pendinglistspec1.cc; tests/pendinglist1.cc.
For an admitted completed element, OK() shall return true without modifying attributes or links. It shall not validate threshold positivity, current-time expiry, external handler policy or list sorting. Its use shall not dereference a handler or flag merely to validate their stored pointer values. This element checker shall not establish the inherited ring's structural validity or make a stale active-event position usable.
The element checker supplies an embedded-list hook while deadline validity and ownership remain caller/queue obligations.
Internal source headers: Pending_List_defs.hh and Pending_Element_defs.hh. Names belong to Parma_Polyhedra_Library::Implementation::Watchdog. Members for element contracts apply to Pending_Element<Threshold>; queue contracts apply to Pending_List<Traits>.
bool OK() const;
Check live elements before/after attribute replacement and inactive pooled nodes with expired external lifetimes, without accessing stale external bindings.
src/Pending_List_defs.hh; src/Pending_List_inlines.hh; src/Pending_List_templates.hh; src/Pending_Element_defs.hh; src/Pending_Element_inlines.hh; src/Threshold_Watcher_defs.hh; src/Threshold_Watcher_templates.hh; src/Watchdog.cc; tests/pendinglistspec1.cc; tests/pendinglist1.cc.
Construction shall create a valid empty active sequence and empty free pool. Destruction shall release every owned active and pooled node and its threshold exactly once. It shall not delete borrowed handlers or flags, invoke notification actions or change external expired flags. Independent queue owners shall have independent nodes and lifetimes. No supported owner copy/assignment shall be required under 🔗 1. Threshold-ordered pending events and caller prerequisites.
Both active and recycled nodes remain queue-owned, while notification objects remain externally owned.
Internal source headers: Pending_List_defs.hh and Pending_Element_defs.hh. Names belong to Parma_Polyhedra_Library::Implementation::Watchdog. Members for element contracts apply to Pending_Element<Threshold>; queue contracts apply to Pending_List<Traits>.
Pending_List(); ~Pending_List();
Count threshold construction/destruction across mixed active/free owners, empty owners and separate queues; verify no external handler destruction or notification.
src/Pending_List_defs.hh; src/Pending_List_inlines.hh; src/Pending_List_templates.hh; src/Pending_Element_defs.hh; src/Pending_Element_inlines.hh; src/Threshold_Watcher_defs.hh; src/Threshold_Watcher_templates.hh; src/Watchdog.cc; tests/pendinglistspec1.cc; tests/pendinglist1.cc.
Successful insertion shall add exactly one active event with the supplied attributes and return its live position. Traversing the active sequence shall produce nondecreasing threshold order under the supplied strict weak comparison. Every previously active event shall remain with its prior threshold, handler, flag and node identity. Distinct events with equivalent thresholds shall all remain present; their relative order shall not be required by this interface. Insertion shall not act on handlers or modify external flags. Threshold values need not be positive or related to a clock merely to use this internal queue.
Ordered pending storage supports both timer and computational-weight clients without imposing one client's duration validation on the generic container.
Internal source headers: Pending_List_defs.hh and Pending_Element_defs.hh. Names belong to Parma_Polyhedra_Library::Implementation::Watchdog. Members for element contracts apply to Pending_Element<Threshold>; queue contracts apply to Pending_List<Traits>.
iterator insert(const typename Traits::Threshold& deadline, const Handler& handler, bool& expired_flag);
Compare all small insertion permutations, descending histories, duplicate/equivalent thresholds, zero thresholds and exact event identities with an independent ordered model.
src/Pending_List_defs.hh; src/Pending_List_inlines.hh; src/Pending_List_templates.hh; src/Pending_Element_defs.hh; src/Pending_Element_inlines.hh; src/Threshold_Watcher_defs.hh; src/Threshold_Watcher_templates.hh; src/Watchdog.cc; tests/pendinglistspec1.cc; tests/pendinglist1.cc.
An insertion's threshold argument may borrow the threshold of an already active element; insertion shall preserve that source and copy its value into the new event. Handlers and flags may be shared among several active events. Their reference identities and preexisting flag values shall remain unchanged by insertion. These aliases shall not permit reuse of erased positions as active-event sources or destruction of external objects still referenced by active events.
Watchdog records may share external notification state or use an existing active threshold without transferring its ownership.
Internal source headers: Pending_List_defs.hh and Pending_Element_defs.hh. Names belong to Parma_Polyhedra_Library::Implementation::Watchdog. Members for element contracts apply to Pending_Element<Threshold>; queue contracts apply to Pending_List<Traits>.
iterator insert(const typename Traits::Threshold& deadline, const Handler& handler, bool& expired_flag);
Insert from each active threshold reference into fresh and recycled nodes, share handler/flag objects and verify all source values and bindings survive.
src/Pending_List_defs.hh; src/Pending_List_inlines.hh; src/Pending_List_templates.hh; src/Pending_Element_defs.hh; src/Pending_Element_inlines.hh; src/Threshold_Watcher_defs.hh; src/Threshold_Watcher_templates.hh; src/Watchdog.cc; tests/pendinglistspec1.cc; tests/pendinglist1.cc.
Erasure shall require a live active position belonging to this queue. It shall remove exactly that event from the active sequence, preserve every other event and its ordering/identity, and return the removed event's next active position or this queue's end. It shall retain the removed node in the reusable pool without destroying its threshold, notifying its handler or changing its flag. The removed position shall cease to denote an active event even while the underlying node remains allocated. Erasure shall not allocate.
Cancellation removes a logical event while retaining node storage for later low-allocation use.
Internal source headers: Pending_List_defs.hh and Pending_Element_defs.hh. Names belong to Parma_Polyhedra_Library::Implementation::Watchdog. Members for element contracts apply to Pending_Element<Threshold>; queue contracts apply to Pending_List<Traits>.
iterator erase(iterator position);
Erase every possible active position, singleton and repeated front/back histories; check exact successor, unchanged surviving identities and attributes, no allocation or notification and retained threshold lifetimes.
src/Pending_List_defs.hh; src/Pending_List_inlines.hh; src/Pending_List_templates.hh; src/Pending_Element_defs.hh; src/Pending_Element_inlines.hh; src/Threshold_Watcher_defs.hh; src/Threshold_Watcher_templates.hh; src/Watchdog.cc; tests/pendinglistspec1.cc; tests/pendinglist1.cc.
When inactive nodes are available, insertion shall reuse one of them rather than allocate a new node. It shall replace every event attribute before linking the reused node into the sorted active sequence. The old external handler/flag bindings shall not be accessed during reuse. No particular selection order among available free nodes shall be required. Without an inactive node, insertion shall allocate a new properly aligned event node. Threshold operation costs shall remain those of the admitted nonthrowing threshold type.
Recycling reduces later event-node allocation while requiring complete replacement of old notification bindings.
Internal source headers: Pending_List_defs.hh and Pending_Element_defs.hh. Names belong to Parma_Polyhedra_Library::Implementation::Watchdog. Members for element contracts apply to Pending_Element<Threshold>; queue contracts apply to Pending_List<Traits>.
iterator insert(const typename Traits::Threshold& deadline, const Handler& handler, bool& expired_flag);
Exhaust and replenish pools, disable allocation during reuse, check reused node-address membership and over-alignment, and replace bindings whose former external objects have been destroyed.
src/Pending_List_defs.hh; src/Pending_List_inlines.hh; src/Pending_List_templates.hh; src/Pending_Element_defs.hh; src/Pending_Element_inlines.hh; src/Threshold_Watcher_defs.hh; src/Threshold_Watcher_templates.hh; src/Watchdog.cc; tests/pendinglistspec1.cc; tests/pendinglist1.cc.
iterator and const_iterator shall retain the corresponding embedded-list iterator types and 🔗 7. Embedded-list iterator borrowing and valid linked positions, 🔗 8. Embedded-list position binding and lifetime, 🔗 9. Embedded-list typed element access, 🔗 10. Embedded-list bidirectional traversal and 🔗 11. Embedded-list position equality. The public nonconst begin/end members shall bound exactly the active sequence; free nodes shall never appear in that range. End shall be comparable and support retreat when nonempty, but not dereference. Positions shall preserve node identity under other event insertion/erasure, subject to 🔗 1. Threshold-ordered pending events and caller prerequisites. Clients shall not change embedded links or break active threshold ordering through the borrowed element access.
Only active events participate in scheduling traversal; cached storage and borrowed-node access must not extend event validity.
Internal source headers: Pending_List_defs.hh and Pending_Element_defs.hh. Names belong to Parma_Polyhedra_Library::Implementation::Watchdog. Members for element contracts apply to Pending_Element<Threshold>; queue contracts apply to Pending_List<Traits>.
using iterator = typename EList<Pending_Element<typename Traits::Threshold>>::iterator; using const_iterator = typename EList<Pending_Element<typename Traits::Threshold>>::const_iterator; iterator begin(); iterator end();
Compare forward/backward prefix/postfix histories, separate cursor copies and exact event addresses before/after unrelated insertions and erasures; verify free nodes are excluded.
src/Pending_List_defs.hh; src/Pending_List_inlines.hh; src/Pending_List_templates.hh; src/Pending_Element_defs.hh; src/Pending_Element_inlines.hh; src/Threshold_Watcher_defs.hh; src/Threshold_Watcher_templates.hh; src/Watchdog.cc; tests/pendinglistspec1.cc; tests/pendinglist1.cc.
empty() shall return true exactly when no active events remain. An empty active sequence shall have equal begin/end positions even if inactive node storage is retained. Emptiness shall not imply that all allocated event nodes have been released. The query shall not notify handlers, modify flags or change the active/free node ownership.
Logical pending-event emptiness and physical pool emptiness are different resource states.
Internal source headers: Pending_List_defs.hh and Pending_Element_defs.hh. Names belong to Parma_Polyhedra_Library::Implementation::Watchdog. Members for element contracts apply to Pending_Element<Threshold>; queue contracts apply to Pending_List<Traits>.
bool empty() const;
Check construction, every erase-to-empty history, retained threshold/node counts and subsequent allocation-free insertion.
src/Pending_List_defs.hh; src/Pending_List_inlines.hh; src/Pending_List_templates.hh; src/Pending_Element_defs.hh; src/Pending_Element_inlines.hh; src/Threshold_Watcher_defs.hh; src/Threshold_Watcher_templates.hh; src/Watchdog.cc; tests/pendinglistspec1.cc; tests/pendinglist1.cc.
For safely inspectable active/free rings, OK() shall require both embedded lists' element checks and nondecreasing active threshold order. An empty active list shall pass when its active/free node checks pass. Free nodes shall not require threshold sorting. Checking shall not invoke handlers, dereference expired external bindings, modify flags or change ownership. Corrupted embedded links shall remain outside the checker domain; this operation shall not provide memory-safe diagnosis of arbitrary ownership corruption. Clients may check and repair a threshold-order violation before resuming ordinary queue operations.
Queue consistency adds threshold order to the embedded-node hooks without validating canceled notification objects or arbitrary corrupted memory.
Internal source headers: Pending_List_defs.hh and Pending_Element_defs.hh. Names belong to Parma_Polyhedra_Library::Implementation::Watchdog. Members for element contracts apply to Pending_Element<Threshold>; queue contracts apply to Pending_List<Traits>.
bool OK() const;
Check empty/singleton/sorted states, every adjacent valid-ring order violation and repaired order, unsorted free-node histories and absence of external notification side effects.
src/Pending_List_defs.hh; src/Pending_List_inlines.hh; src/Pending_List_templates.hh; src/Pending_Element_defs.hh; src/Pending_Element_inlines.hh; src/Threshold_Watcher_defs.hh; src/Threshold_Watcher_templates.hh; src/Watchdog.cc; tests/pendinglistspec1.cc; tests/pendinglist1.cc.
With the nonthrowing threshold and comparison prerequisites of 🔗 1. Threshold-ordered pending events and caller prerequisites, a reported event-node allocation failure shall leave the active sequence, free pool, all existing event attributes, handler bindings and flag values unchanged. No incomplete event node shall remain owned or linked. The same queue shall permit a later successful insertion and ordinary erasure. Erasure and insertion using an available pooled node shall not require an event-node allocation. These guarantees shall not promise recovery from violated threshold or linking preconditions.
Allocation occurs before an otherwise nonthrowing insertion can commit a new active event.
Internal source headers: Pending_List_defs.hh and Pending_Element_defs.hh. Names belong to Parma_Polyhedra_Library::Implementation::Watchdog. Members for element contracts apply to Pending_Element<Threshold>; queue contracts apply to Pending_List<Traits>.
iterator insert(const typename Traits::Threshold& deadline, const Handler& handler, bool& expired_flag); iterator erase(iterator position);
Fail the observed new-node allocation for empty and populated owners, verify complete event/address/flag/resource preservation, retry insertion and then exercise allocation-disabled pool reuse.
src/Pending_List_defs.hh; src/Pending_List_inlines.hh; src/Pending_List_templates.hh; src/Pending_Element_defs.hh; src/Pending_Element_inlines.hh; src/Threshold_Watcher_defs.hh; src/Threshold_Watcher_templates.hh; src/Watchdog.cc; tests/pendinglistspec1.cc; tests/pendinglist1.cc.