package miaou-core
Install
dune-project
Dependency
Authors
Maintainers
Sources
md5=60a3b9f181f24572a06a9492532bfdda
sha512=fcc35a275066be2900e6201782faf47503076fa4640f08cf78067835a6f447b74613009e55b2ac799adb7ca46f1bffa261fc5971753f2cc3c6bef327511c7ef6
doc/miaou-core.driver-common/Miaou_driver_common/Pager_notify/index.html
Module Miaou_driver_common.Pager_notifySource
Debounced notification system for background widget updates.
This module provides a thread-safe notification mechanism that prevents excessive re-rendering when background threads (e.g., pager appenders) request UI updates. Notifications are debounced to coalesce bursts of updates into a single render cycle.
Typical usage:
(* Create notifier with 80ms debounce *)
let notifier = Pager_notify.create ~debounce_s:0.08 () in
(* Background thread requests render *)
Pager_notify.notify notifier ;
(* Main loop checks if enough time has passed *)
if Pager_notify.should_refresh notifier then (
(* Perform render *)
Pager_notify.mark_refreshed notifier ;
...
)Opaque notifier state
Request a render from a background thread.
Sets the notification timestamp to the current time. Multiple calls within the debounce window are coalesced into a single refresh.
Thread-safe: can be called from any thread.
Check if a refresh should be performed.
Returns true if:
- A notification was received AND
- Enough time has passed since the last notification (>= debounce_s)
This does NOT consume the notification - call mark_refreshed after performing the actual render.
Thread-safe: can be called from any thread.
Mark that a refresh was performed.
Resets the notification timestamp to 0, indicating that the pending notification has been serviced.
Thread-safe: can be called from any thread.