class

FSWatch::Poll

Inherits FSWatch::Backend < Reference < Object

Constants

DEFAULT_INTERVAL = 1.second

Constructors

new(recursive : Bool, interval : Time::Span | Nil = nil, skip : String -> Bool | Nil = nil, &emit : Event -> )
Source

Instance methods

add(path : String) : Nil

Begin watching path (a file or a directory). With recursive set at construction, backends extend the watch to the tree — natively where the API allows (inotify: add a watch per directory on create; kqueue: rescan on directory NOTE_WRITE; poll: the tree walk is the watch).

Source
remove(path : String) : Nil

Stop watching path (and, for directories, its subtree).

Source
run

The observation loop — runs INSIDE a fiber spawned by the core; returns when stopped. Must never block the scheduler thread: waits go through the event loop (evented IO / sleep / select).

Source
stop

Request teardown; must be callable from any fiber. The run loop may take a bounded moment (stop-check cadence) to actually exit.

Source