Internal watchdog event-action bindings
Handler shall be an abstract interface with const action dispatch and virtual destruction. Calling act() through a live base reference shall dispatch to the selected derived handler. Deleting an owned derived handler through a base pointer shall run its derived destruction and release its wrapper exactly once. A borrowed handler shall not become owned merely by being passed to a pending event.
Construction, dispatch and destruction shall require the selected external callback/flag objects and synchronization to remain valid. These wrappers shall not themselves require global PPL initialization or timer availability. A caller invoking actions in a signal handler or shared threshold-watcher context shall retain that surrounding interface's operation and thread/signal restrictions.
Notification storage relies on const polymorphic dispatch and deletion through its abstract action interface.
Internal source header: Handler_defs.hh. Names belong to Parma_Polyhedra_Library::Implementation::Watchdog; constructor excerpts apply to the indicated wrapper class.
class Handler { public: virtual void act() const = 0; virtual ~Handler(); };
Check base-reference action dispatch and derived destruction with owned wrappers, and preserve borrowed external objects across wrapper destruction.
src/Handler_defs.hh; src/Handler_inlines.hh; src/Handler.cc; src/Threshold_Watcher_templates.hh; src/Watchdog.cc; tests/handlerspec1.cc.
Handler_Flag construction shall bind the supplied holder reference and flag object without invoking a priority query, installing the flag or taking ownership of either external object. Copy construction and rvalue construction shall preserve those same bindings; later actions shall observe the holder's current value rather than a pointer-value snapshot made during construction. Ordinary assignment of this reference-binding wrapper shall not be supported.
The holder shall be a live volatile pointer to const Flag_Base and Flag* shall convert to Flag_Base*. For a nonnull holder, the existing pointee shall belong to the compatible Flag object family, so the implementation's declared base-to-flag cast is well formed and valid. The flag/holder and any nonnull pointee shall outlive their actual access. Wrapper destruction shall not delete or alter them.
A retained holder reference must follow later client updates, and priority comparison requires a valid concrete flag object behind the base pointer.
Internal source header: Handler_defs.hh. Names belong to Parma_Polyhedra_Library::Implementation::Watchdog; constructor excerpts apply to the indicated wrapper class.
template <typename Flag_Base, typename Flag> class Handler_Flag; Handler_Flag(const Flag_Base* volatile& holder, Flag& flag);
Check copied/rvalue wrappers, changed holder values after construction, compatible multiple-base pointer adjustment, construction without priority queries and unchanged borrowed-object lifetimes.
src/Handler_defs.hh; src/Handler_inlines.hh; src/Handler.cc; src/Threshold_Watcher_templates.hh; src/Watchdog.cc; tests/handlerspec1.cc.
On act(), a null bound holder shall be set to the bound flag address without querying flag priorities. For a nonnull valid holder, the action shall install the bound flag exactly when the existing flag's observed priority is strictly lower than the bound flag's observed priority. Equal or higher existing priority shall preserve the existing pointer. Priority queries shall supply comparable values consistent with that call's decision; they shall not themselves rebind the holder. External priority changes between calls shall be observed by later actions.
The operation shall not own/delete flags or allocate a wrapper. If a priority query reports an exception, it shall propagate through ordinary C++ dispatch without an assignment by the handler to the holder; any side effects of the query itself shall remain its own contract.
Competing abandonment requests need the highest observed priority and a definite equal-priority retention rule.
Internal source header: Handler_defs.hh. Names belong to Parma_Polyhedra_Library::Implementation::Watchdog; constructor excerpts apply to the indicated wrapper class.
void Handler_Flag<Flag_Base, Flag>::act() const;
Check null holders, every smaller/equal/larger signed priority pair, dynamic priority changes, compatible base pointers and priority exceptions with unchanged holder identity.
src/Handler_defs.hh; src/Handler_inlines.hh; src/Handler.cc; src/Threshold_Watcher_templates.hh; src/Watchdog.cc; tests/handlerspec1.cc.
Handler_Function construction shall store the supplied function pointer without invoking it. Copy and rvalue construction shall retain the same target. Ordinary assignment shall not be supported. A null pointer may be stored and destroyed without invocation, but shall not be an admitted action target. The callable code shall remain valid at invocation. Construction/copy/destruction shall not call or own the function or allocate auxiliary callback state.
A function wrapper owns its pointer binding while the callable code and its external state remain the caller's responsibility.
Internal source header: Handler_defs.hh. Names belong to Parma_Polyhedra_Library::Implementation::Watchdog; constructor excerpts apply to the indicated wrapper class.
class Handler_Function; Handler_Function(void (*function)());
Check zero callback calls during construction/copy/destruction, copied target identity by later dispatch, null-bound noninvoked wrappers and nonassignability.
src/Handler_defs.hh; src/Handler_inlines.hh; src/Handler.cc; src/Threshold_Watcher_templates.hh; src/Watchdog.cc; tests/handlerspec1.cc.
With a live nonnull target, Handler_Function::act() shall call the stored function exactly once per invocation and return normally exactly when that call returns normally. A callback exception shall propagate with its identity and previously performed callback effects; no rollback of arbitrary callback state shall be required. The wrapper shall remain bound to the same target and permit a later admitted call. No invocation shall silently replace the callback with another target or delete its external state.
Ordinary callback completion and callback failure must remain observable through the const action interface.
Internal source header: Handler_defs.hh. Names belong to Parma_Polyhedra_Library::Implementation::Watchdog; constructor excerpts apply to the indicated wrapper class.
void Handler_Function::act() const;
Use distinct callbacks, a callback that records an effect then throws a unique exception, repeated const/base dispatch and successful retry.
src/Handler_defs.hh; src/Handler_inlines.hh; src/Handler.cc; src/Threshold_Watcher_templates.hh; src/Watchdog.cc; tests/handlerspec1.cc.