File_Watcher module

process_changes

procedure · 1 overloadSource

Collects what the system has reported, calls the callback for every change whose merge window has passed, and returns (changed, needs_wait, wait_seconds): whether any callback ran, whether more may come, and how long to wait before the next call in the worst case.

It never blocks; call it from your own loop and sleep for wait_seconds (at most 0.1) when needs_wait is true, as a game loop would rather call it every frame. needs_wait is true for as long as the watcher watches anything. The change handed to the callback is valid only during the call. The callback must not call process_changes or deinit on the same watcher. Fails an assertion on a watcher that was not set up, moved, or is being polled recursively.

process_changes :: (
    watcher: *File_Watcher
) -> (changed: bool, needs_wait: bool, wait_seconds: float64)

Collects what the system has reported, calls the callback for every change whose merge window has passed, and returns (changed, needs_wait, wait_seconds): whether any callback ran, whether more may come, and how long to wait before the next call in the worst case.

It never blocks; call it from your own loop and sleep for wait_seconds (at most 0.1) when needs_wait is true, as a game loop would rather call it every frame. needs_wait is true for as long as the watcher watches anything. The change handed to the callback is valid only during the call. The callback must not call process_changes or deinit on the same watcher. Fails an assertion on a watcher that was not set up, moved, or is being polled recursively.

Parameters

watcher: *File_Watcher

Returns

changed: bool
needs_wait: bool
wait_seconds: float64

See also